Skip to content

Instantly share code, notes, and snippets.

@mehul0810
Last active May 2, 2018 16:24
Show Gist options
  • Save mehul0810/b4842744fa6de1f9b1f5d3ecaf0dc967 to your computer and use it in GitHub Desktop.
Save mehul0810/b4842744fa6de1f9b1f5d3ecaf0dc967 to your computer and use it in GitHub Desktop.
<?php
$source_args = apply_filters( 'give_stripe_get_source_args', array(
'type' => 'card',
'token' => $token_id,
) );
$charge_options = array();
if ( give_is_stripe_connected() ) { // This ensures that stripe is connected using Connect API.
$charge_options['stripe_account'] = give_get_option( 'give_stripe_user_id' );
}
// Create source from token.
$source = \Stripe\Source::create( $source_args, $charge_options );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment