Skip to content

Commit acc793e

Browse files
committed
Add statement descriptor and transaction description
1 parent 0cc8da5 commit acc793e

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

src/Action/ObtainNonceAction.php

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,40 +46,19 @@ public function execute($request) {
4646
$this->gateway->execute($getHttpRequest);
4747
if ($getHttpRequest->method == 'POST' && isset($getHttpRequest->request['payment_intent'])) {
4848
$model['nonce'] = $getHttpRequest->request['payment_intent'];
49-
5049
return;
5150
}
5251

53-
if (false) {
54-
$email = $model['local']['email'];
55-
56-
// Search for customer
57-
$customer_id = md5($email);
58-
try {
59-
$customer = $model['stripeElementsGateway']->customer()->find($customer_id);
60-
} catch (\Exception $e) {
61-
$result = $model['stripeElementsGateway']->customer()->create([
62-
'id' => $customer_id,
63-
'email' => $email,
64-
]);
65-
}
66-
//dump($StripeElementsGateway->clientToken()->generate());exit;
67-
$clientToken = $model['stripeElementsGateway']->clientToken()->generate([
68-
'customerId' => $customer_id,
69-
]);
70-
}
71-
7252
$model['stripePaymentIntent'] = \Stripe\PaymentIntent::create([
73-
'amount' => round($model['amount'] * 100),
53+
'amount' => round($model['amount'] * pow(10, $model['currencyDigits'])),
7454
'currency' => $model['currency'],
75-
// Verify your integration in this guide by including this parameter
7655
'metadata' => ['integration_check' => 'accept_a_payment'],
56+
'statement_descriptor' => $model['statement_descriptor_suffix'],
57+
'description' => $model['description'],
7758
]);
7859

7960
$this->gateway->execute($renderTemplate = new RenderTemplate($this->templateName, array(
80-
//'model' => $model,
8161
'amount' => $model['currencySymbol'] . ' ' . number_format($model['amount'], $model['currencyDigits']),
82-
//'clientToken' => $clientToken,
8362
'client_secret' => $model['stripePaymentIntent']->client_secret,
8463
'publishable_key' => $model['publishable_key'],
8564
'actionUrl' => $getHttpRequest->uri,

0 commit comments

Comments
 (0)