Stripe Process:
- Generate Token: Get customer credit details from the web forms and send it to the stripe server.
- Charge Card: Use the generated token to charge the Credit Card using Stripe API.
- Payment Information: Store the response for the future reference.
Generate Stripe Token:
- Input: String url = ‘card[exp_month]=12&card[exp_year]=2021&card[number]=4242424242424242&card[cvc]=222&card[name]=Sam Jaba’;
- Http http = new Http();
- HttpRequest request = new HttpRequest();
- request.setEndpoint(‘https://api.stripe.com/v1/tokens’);
- request.setMethod(‘POST’);
- request.setHeader(‘Content-Type’, ‘application/x-www-form-urlencoded’);
- request.setHeader(‘Authorization’,’Bearer {Place your Stripe Secret Key}’);
- request.setBody(url);
- HttpResponse response = http.send(request);
- Map<String, Object> responseObjMap = (Map<String,Object>) JSON.deserializeUntyped(response.getBody());
Once the token is generated customer can be charged using other API’s using this link https://stripe.com/docs/api
Verify request Using Postman:
1.Token Generation:
Header Input:

Input Body:

Response:

Pros:
- Instant approval is one of the benefits of using Stripe.
- No redirection to Merchant Page.
- Simple process.
Cons:
- Stripe stopped accepting Credit card information from the Stripe dashboard.