Sunday, May 20, 2012

The REST API for Credit Card Payment

You might thought Paypal API would be mentioned.

But no, it's Stripe, the new kid on the block.

It is so simple to charge to a credit card with it's 1 line of http request:


curl https://api.stripe.com/v1/charges \
   -u vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE: \
   -d amount=400 \
   -d currency=usd \
   -d "description=Charge for site@stripe.com" \
   -d "card[number]=4242424242424242" \
   -d "card[exp_month]=12" \
   -d "card[exp_year]=2012" \
   -d "card[cvc]=123"

Charges: 2.9% + 30 cents

No comments:

Post a Comment