Skip to content

Instantly share code, notes, and snippets.

@IanSaunders
Last active August 29, 2015 14:13
Show Gist options
  • Save IanSaunders/6940ec15bdb0eafec93d to your computer and use it in GitHub Desktop.
Save IanSaunders/6940ec15bdb0eafec93d to your computer and use it in GitHub Desktop.
capture card
StripeToken token = new StripeToken();
token.setCardDetailsID("card details id");
token.setStripeCustomerID("stripe customer id");
if(token_.getAccountID() == null) {
Account account = new Account();
account.getProfile().setFirstName("First Name");
account = Account.create(account);
token_.setAccountID(account.getID());
}
token = StripeToken.create(token_);
PaymentMethod paymentMethod = new PaymentMethod();
paymentMethod.setLinkID(token.getID());
paymentMethod.setName("Name");
paymentMethod.setAccountID(token.getAccountID());
paymentMethod.setDescription("Stripe (...)");
paymentMethod.setExpiryDate("YY/MM"); //Month with leading 0
paymentMethod.setGateway(PaymentGateway.stripe);
PaymentMethod.create(paymentMethod)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment