@@ -30,6 +30,12 @@ class Checkout implements Responsable
30
30
31
31
private array $ custom = [];
32
32
33
+ private ?string $ productName = null ;
34
+
35
+ private ?string $ description = null ;
36
+
37
+ private ?string $ thankYouNote = null ;
38
+
33
39
private ?string $ redirectUrl ;
34
40
35
41
private ?DateTimeInterface $ expiresAt ;
@@ -157,6 +163,27 @@ public function withCustomData(array $custom): self
157
163
return $ this ;
158
164
}
159
165
166
+ public function withProductName (string $ productName ): self
167
+ {
168
+ $ this ->productName = $ productName ;
169
+
170
+ return $ this ;
171
+ }
172
+
173
+ public function withDescription (string $ description ): self
174
+ {
175
+ $ this ->description = $ description ;
176
+
177
+ return $ this ;
178
+ }
179
+
180
+ public function withThankYouNote (string $ thankYouNote ): self
181
+ {
182
+ $ this ->thankYouNote = $ thankYouNote ;
183
+
184
+ return $ this ;
185
+ }
186
+
160
187
public function redirectTo (string $ url ): self
161
188
{
162
189
$ this ->redirectUrl = $ url ;
@@ -201,9 +228,12 @@ public function url(): string
201
228
], function ($ value ) {
202
229
return ! is_null ($ value );
203
230
}),
204
- 'product_options ' => [
231
+ 'product_options ' => array_filter ([
232
+ 'name ' => $ this ->productName ,
233
+ 'description ' => $ this ->description ,
234
+ 'receipt_thank_you_note ' => $ this ->thankYouNote ,
205
235
'redirect_url ' => $ this ->redirectUrl ?? config ('lemon-squeezy.redirect_url ' ),
206
- ],
236
+ ]) ,
207
237
'expires_at ' => isset ($ this ->expiresAt ) ? $ this ->expiresAt ->format (DateTimeInterface::ATOM ) : null ,
208
238
],
209
239
'relationships ' => [
0 commit comments