Skip to content

Instantly share code, notes, and snippets.

@appsgenii
Last active January 18, 2016 22:41
Show Gist options
  • Select an option

  • Save appsgenii/f8b0913aa8fd2c8d32b7 to your computer and use it in GitHub Desktop.

Select an option

Save appsgenii/f8b0913aa8fd2c8d32b7 to your computer and use it in GitHub Desktop.
# I am using Stripe Connect and stroing Customers to my account
# Get Customer from Stripe
stripe_customer = Stripe::Customer.retrieve(stripe_customer_id)
# From AliPay Checkout I got stripeToken e.g. atok_asjdasalkj
strip_alipay = stripe_customer.sources.create({ source: params[:stripeToken] })
# I saved strip_alipay.id for future use
stripe_charge = Stripe::Charge.create(
{
amount: dollar_to_cents(amount),
currency: currency,
customer: stripe_customer.id,
source: strip_alipay.id,
description: charge_description,
application_fee: dollar_to_cents(application_fee),
capture: true,
statement_descriptor: statement_descriptor,
metadata: charge_metadata
},
payment_gateway.stripe_access_token
)
# Stripe::InvalidRequestError (Customer cus_7kC9NhdObmOEer does not have card with ID aliacc_17UhwaA0l6PwmVzeNyajeshW):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment