• Blog
  • < 1

Integrating Stripe Payment Gateway to a Knowledge Base Management System

  • POSTED ON
  • May 31, 2017
  • POSTED BY
  • Muhammad Ahmad
  • POSTED ON May 31, 2017
  • POSTED BY Muhammad Ahmad

vteam #557 has been working on a knowledge base management system. The client required stripe integration as a payment gateway to charge user subscription fee during the registration process. In this application, an option to purchase add-ons has been given to the users at the same time. Problem: In stripe, once the subscription plans (fixed) are created, the....

vteam #557 has been working on a knowledge base management system. The client required stripe integration as a payment gateway to charge user subscription fee during the registration process. In this application, an option to purchase add-ons has been given to the users at the same time.

Problem

In stripe, once the subscription plans (fixed) are created, the membership fee cannot be altered. Due to the stripe restriction, it is impossible to charge both subscription and add-ons in one request.

Both (subscription fee and add-ons fee) would be charged separately, which would eventually incur an additional cost to the merchant. As you know that stripe charges a small fee per transaction, so two separate charges would be displayed on the user’s bank statement. This would cause a lot of confusion at user end.

Solution

After doing some R&D, vteams engineer developed a solution by creating an invoice in stripe before sending the subscription purchase request to the user. Stripe API would then charge customer subscription fee as well as any outstanding invoices implicit without any further request. The following code was executed:

$customer = \Stripe\Customer::create($data);

			$invoice = \Stripe\InvoiceItem::create(array(
                                        "customer" => $customer->id,
                                        "amount" => $additionalAmount*100,
                                        "currency" => "usd",
                                        "description" => "Additional Charges")
                                    );

			$customer->subscriptions->create(array("plan" => $plan->plan_id));

By implementing the above mentioned solution, some portion of the merchant fee along with the full PCI Compliance fee was saved.

ABOUT THE AUTHOR

Muhammad Ahmad

0 Comments

Leave a Reply

More Related Article
We provide tips and advice on delivering excellent customer service, engaging your customers, and building a customer-centric business.