Stripe Integration with Salesforce Using REST API

Stripe is a Payment gateway plus a merchant processor. You can take credit cards directly from your websites. Stripe is free but there is fee for the transaction. Stripe account can be created using the following link https://stripe.com.

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:

  1. Input: String url = ‘card[exp_month]=12&card[exp_year]=2021&card[number]=4242424242424242&card[cvc]=222&card[name]=Sam Jaba’;
  2. Http http = new Http();
  3. HttpRequest request = new HttpRequest();
  4. request.setEndpoint(‘https://api.stripe.com/v1/tokens’);
  5. request.setMethod(‘POST’);
  6. request.setHeader(‘Content-Type’, ‘application/x-www-form-urlencoded’);
  7. request.setHeader(‘Authorization’,’Bearer {Place your Stripe Secret Key}’);
  8. request.setBody(url);
  9. HttpResponse response = http.send(request);
  10. 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.
Ref Link:

https://stripe.com/docs/api

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Harnessing Generative AI in Healthcare Insurance: Streamlining Operations and Enhancing Member Insights

Healthcare insurance providers are navigating new ground and capitalizing on new opportunities made possible through artificial intelligence. AI can be utilized to lower costs for payers and improve the member experience as well as the overall health and well-being of members, leading to greater member satisfaction and improving trust and reputation for the payer’s brand.

Read Article »

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.