rhiner402
Member
Posted 1 year ago #
This code fixes the Name.. but not the description. (from stripe-display.php)
Stripe.createToken({
number: jQuery('.card-number').val(),
cvc: jQuery('.card-cvc').val(),
exp_month: jQuery('.card-expiry-month').val(),
exp_year: jQuery('.card-expiry-year').val(),
name: jQuery('input[name=wp_stripe_name]').val(),
}, amount, stripeResponseHandler);
http://wordpress.org/extend/plugins/wp-stripe/
rhiner402
Member
Posted 1 year ago #
The description requires a change to the wp_stripe_charge function
rhiner402
Member
Posted 1 year ago #
This puts the comment description into Stripe...
function wp_stripe_charge($amount, $card, $description) {
/* Currency - All amounts must be denominated in USD when creating charges with Stripe — the currency conversion happens automatically */
$currency = 'usd';
/* Card - Token from stripe.js is provided (not individual card elements)*/
$opts = array(
'card' => $card,
'amount' => $amount,
'currency' => $currency
);
if ( $description ) {
$opts['description'] = $description;
}
$charge = Stripe_Charge::create($opts);
return $charge;
}
rhiner402
Member
Posted 1 year ago #
Thanks to Brian Collins at Stripe.com for making these code suggestions!
Thanks for that, I'll be able to review the strip suggestions & enhancements next week when I'm done launching @happytables :) Cheers, Noel
Where did you find the bit about:
name: jQuery('input[name=wp_stripe_name]').val(),
This doesn't appear in the API documentation for creating a charge.
Cheers
Edit: Not in the part of creating a charge, but was in a sep. section for the token. Not sure if I'll be adding it yet of creating customer objects (might do both).