We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8e2a578 commit cea6b4aCopy full SHA for cea6b4a
src/Components/Button.php
@@ -122,18 +122,18 @@ public function phone(string $phone): self
122
}
123
124
/**
125
- * @param array $postback
+ * @param $postback
126
*
127
- * @throws CouldNotCreateButton
128
* @return $this
+ * @throws CouldNotCreateButton|\JsonException
129
*/
130
- public function postback(array $postback): self
+ public function postback($postback): self
131
{
132
if (blank($postback)) {
133
throw CouldNotCreateButton::postbackNotProvided();
134
135
136
- $this->payload['payload'] = json_encode($postback);
+ $this->payload['payload'] = is_string($postback) ? $postback : json_encode($postback, JSON_THROW_ON_ERROR);
137
$this->isTypePostback();
138
139
return $this;
0 commit comments