Skip to content

Instantly share code, notes, and snippets.

@cjavilla-stripe
Created July 21, 2020 22:27
Show Gist options
  • Save cjavilla-stripe/462b7e124b7b4a9bd602bd7ebe054d1e to your computer and use it in GitHub Desktop.
Save cjavilla-stripe/462b7e124b7b4a9bd602bd7ebe054d1e to your computer and use it in GitHub Desktop.
$customer = \Stripe\Customer::create([
'email' => 'jenny.rosen@example.com',
'payment_method' => 'pm_card_visa',
'invoice_settings' => [
'default_payment_method' => 'pm_card_visa',
],
]);
$connectCustomer = \Stripe\Customer::create([
'email' => 'jenny.rosen@example.com',
], ['stripe_account' => $acct]);
$connectPaymentMethod = \Stripe\PaymentMethod::create([
'customer' => $customer->id, // ID of the customer on the platform account.
'payment_method' => $customer->invoice_settings->default_payment_method, // ID of the PaymentMethod on your platform account
], ['stripe_account' => $acct]);
$paymentIntent = \Stripe\PaymentIntent::create([
'payment_method_types' => ['card'],
'amount' => 1000,
'currency' => 'usd',
'application_fee_amount' => 222,
'payment_method' => $connectPaymentMethod->id,
'customer' => $connectCustomer->id,
'setup_future_usage' => 'off_session',
'confirm' => true,
'metadata' => [
'need_id' => 'x',
],
], ['stripe_account' => $acct]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment