Understanding Stripe API

Authorization you api key goes here

wether you see this

curl https://api.stripe.com/v1/charges \
  -u sk_test_CFTRjaUvmZ1ZwcD0AQuwb4bS00JhEqWYgq: \
  -d amount=2000 \
  -d currency=eur \
  -d source=tok_mastercard \
  -d description="Charge for [email protected]"

the request url is like this

h ttps://api.stripe.com/v1/charges?amount=2000&currency=eur&source=tok_mastercard&description=“charge for [email protected]

how to get “source=tok_(mastercard-visa)” which is the details of the card

create a token card like this

this is what you see

curl https://api.stripe.com/v1/tokens \
  -u sk_test_CFTRjaUvmZ1ZwcD0AQuwb4bS00JhEqWYgq: \
  -d "card[number]=4242424242424242" \
  -d "card[exp_month]=12" \
  -d "card[exp_year]=2020" \
  -d "card[cvc]=123"
this is the request url

https://api.stripe.com/v1/tokens?card[number]=4242424242424242&card[exp_month]=12&card[exp_year]=2020&card[cvc]=123

In the response of this request, you get the id wich it would be the 
source=tok_(mastercard-visa)

if you want to create a customer so you don't have to ask every time for the card details this is how you save the card details in stripe so you don't have to save the details in your server putting in a risk

curl https://api.stripe.com/v1/customers \
  -u sk_test_CFTRjaUvmZ1ZwcD0AQuwb4bS00JhEqWYgq: \
  -d description="Customer for [email protected]" \
  -d source=tok_amex

web URL request

https://api.stripe.com/v1/customers?source=tok_mastercard-visa)&description="CustomerExample)

in the response you would have to store de customers ID wich is the one you will use instead of the source=tok_(mastercard-visa)
EXAMPLE:
h ttps://api.stripe.com/v1/charges?amount=2000&currency=eur&customer=(customer ID)&description="charge for [email protected]"


## Using Stripe and Apple Pay vs. in-app purchases

Apple Pay doesn’t replace Apple’s [In-App Purchase API](https://developer.apple.com/in-app-purchase). You can use any of Stripe’s supported payment methods and Apple Pay in your iOS app to sell physical goods (e.g., groceries and clothing) or for services your business provides (e.g., club memberships and hotel reservations). These payments are processed through Stripe and you only need to pay Stripe’s [processing fee](https://stripe.com/es/pricing).

Apple’s [developer terms](https://developer.apple.com/app-store/review/guidelines/) require their In-App Purchase API be used for digital “content, functionality, or services,” such as premium content for your app or subscriptions for digital content. Payments made using the In-App Purchase API are processed by Apple and subject to their transaction fees.

It is a simple example of how to understand the API of Stripe ... I haven't uploaded my app to the app store so I don't know more than this 

If anyone has more information please shared it !
2 Likes