2

I am not sure which stackexchange website is correct website to post this question.

I haven't worked on payment process before - and I need help with payment process using Stripe -

we are developing a website in which we will be selling items from different businesses.

Now the flow of the Application is like this:

  1. Customer comes to our system and signs up
  2. Customer searches for a business
  3. Customer adds items from that business to a shopping cart
  4. If the customer selects pay online we get the debit card information and generate a token using Stripe.

  5. Now an order can only be placed if the business accepts the order. For this we have a Dashboard where the Business user will login and wait for the orders. As soon as the order is placed by the customer the Dashboard receives a notification (SignalR connection). The business owner then can accept or decline the order.

If declined we notify the customer that order was declined. If accepted we notify the customer that order was accepted.

Question:

Now the problem I am having understanding is that when do we charge the client/customer?

We have a token generated on the Browser using Stripe. But we only want to charge the Customer if the order is accepted.

The problem with charging the customer AFTER the order is accepted is that WHAT IF the CARD details entered by the customer where incorrect? In this case the charge will fail - but the Admin has already been notified about the order and the Admin has accepted it.

The problem with charging the customer BEFORE is that what if the Admin declines the order. In this case we will have to issue a refund - Which might make the customer upset and not use our system in the future?

What is the best way to do this?

When do we charge the customer?

  • You are currently asking users to authorize payments before they know whether they'll receive anything in return? When precisely is the contract of sale formed? Depending on your jurisdiction, this might be illegal! Ask your lawyers. This is so much more about legal considerations and user experience than it is about software development. Perhaps you'll have to rephrase your process: customers request offers from businesses, which they may then accept by authorizing the payment. Or alternatively: The contract is formed immediately upon payment, but businesses may then cancel the order. – amon May 17 '17 at 21:00
  • @amon take JustEat.co.uk for example. A customer goes to their website , search a restaurant, adds items to the basket, adds debit card details and clicks place order - now the customer is shown a Waiting screen - then after some time it shows if the restaurant has accepted or declined the order (also confirmation email sent to customer) - our scenario is something similar to that - – Dawood Awan May 17 '17 at 21:04
4

This is a business rule.

The answer is you write business logic code in a business logic layer that says when to charge the customer. You don't dictate this with your design. You implement whatever your boss decides to do. Do it in a way they leaves your boss free to change their mind later.

Don't turn your company into either an escrow or a credit service without letting your boss know.

  • True - we will give the final decision to the boss to decide the Business rule - but I am doing my research on this process at the moment, then I am going to go to him with all possible scenarios – Dawood Awan May 17 '17 at 21:08
  • take JustEat.co.uk for example. A customer goes to their website , search a restaurant, adds items to the basket, adds debit card details and clicks place order - now the customer is shown a Waiting screen - then after some time it shows if the restaurant has accepted or declined the order (also confirmation email sent to customer) - our scenario is something similar to that - – Dawood Awan May 17 '17 at 21:08
0

After some research we found out that in stripe we can make a 2 step payment

Step 1 - Authorise the customer card with the order amount (create an uncaptured charge)

Step 2 - After Business has accepted the order - process the payment/charge

Doc Link - https://stripe.com/docs/charges#auth-and-capture

From the documentation:

Auth and capture Stripe supports two-step payments so you can first authorize a charge on your customer’s card, then wait to settle (capture) it later. When a charge is authorized, the funds are guaranteed by the issuing bank and the amount held on the customer’s card for up to seven days. If the charge is not captured within this time, the authorization is canceled and funds released. To authorize a payment without capturing it, make a charge request that also includes the capture parameter with a value of false. This instructs Stripe to only authorize the amount on the customer’s card.

in .NET --

var chargeId = charges.Create(new StripeChargeCreateOptions
                        {
                            Amount = (int) total ,
                            Description = "",
                            Currency = "us",
                            SourceTokenOrExistingSourceId = "PAYMENT_TOKEN",
                            Destination = "DEST_ACCOUNT",
                            CustomerId = "CUSTOMER_STRIPE_ID",


                            Capture = false
                        }).Id;

So what this will do is Authorize the charge but not actually deduct the amount from customers account -

Now when the Business Accepts the order we can then Charge the customer using the chargeId generated in the previous method.

var chargeService = new StripeChargeService();
StripeCharge stripeCharge = chargeService.Capture(order.ChargeId);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.