#Benjamin Carrera

1 messages · Page 1 of 1 (latest)

robust timberBOT
wintry verge
#

Moving this:

// Create the subscription.
       $subscription = $stripe->subscriptions->create([
       'customer' => $customer_id,
                  'items' => [
                        [
                     'price' => $price_id,
                     'quantity' => $quantity,
                   ],
                  ],
        'trial_period_days' => 7,
       ]);

This is not returning "$subscription->latest_invoice->payment_intent->client_secret" so I can use it for collecting the payment information with the js API:

stripe.confirmCardPayment(client_secret, {
                  payment_method: {
                        card: cardNumber,
                        billing_details: {
                              "address": {
                                    "city": billing.city,
                                    "country": 'US',
                                    "line1": billing.address,
                                    "line2": billing.addressTwo,
                                    "postal_code": billing.zipcode,
                                    "state": billing.state
                              },
                              name: name,
                        },
                  }
            }).then((result) => {
                  $("#loader").hide();
                  console.log(result);
                  if(result.error) {
                        $('#show-error div').html("Payment failed: " + result.error.message);
                        $('#show-error').show();
                  } else {
                        // Redirect the customer to their account page
                        //$('#messages').html('Success! Redirecting to your account.');
                        window.location = "register-thankyou.html";
                  }
            });

Can you help me to accomplish this?

#

Hi, can you share the request id for your subscription creation with me?

formal folio
wintry verge