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.
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.
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.