Stripe testing in LIVE mode - stripe-payments

We would like to know how we can test stripe in LIVE for an e-commerce website? The site basically is an e-commerce website and courses are purchased online, how do we test LIVE transactions without using real-time credit cards in stripe?

The purpose of Stripe test mode is to ensure that you get your code into a perfectly working state, and that each type of transaction you are dealing with is fully covered. You can even validate that WebHooks are working by pointing them at your application's test API endpoints.
There's not really a way of 'testing' inside of the live environment as such - typical practice would be to make a real transaction using a company credit card, or one that you are in control of. You can then logon to Stripe Admin and refund the payment once it succeeds.
This is the same with most payment gateways, although there are some that have test mode built into the live API, and used via a specific header, parameter or tracking identifier. Although, this is really just the same end result - you are still testing in test mode.

Use a 100% off coupon and no monies will be transacted. This should allow you to test the flow of things in livemode and make sure everything is in sync without posing a threat to Stripe as a company or your Stripe account.
Note: If you're testing a stripe subscription, you should immediately end the subscription, and delete the "customer" before you forget and it's ACTUALLY processed the next billing cycle.
Here's an example of creating and using 100% off coupons.
Disclaimer: I have NOT tested this method. But I believe my theory is correct.

You can use Customer Credit Balance (https://stripe.com/docs/billing/customer/balance) and use real credit cards to do some final testing of your live implementation. I just did it, it works perfectly and no charge is being done.
Good luck!

This can be accomplished from the Stripe dashboard in one of two ways. The set up for both methods begins in the same way.
Navigate to the Customers section of the Stripe dashboard, and create a new Customer object for yourself (or your employees)
Once you've created the new Customer, add the card details for the real card that you or your developers will using to test the live Stripe integration. This step is necessary because Stripe uses the card number to associate any test payments you make with the Customer you just created.
With the new Customer still selected, you'll see an Actions dropdown to the top right of the Overview page.
From here, you can select one of two solutions to waive costs for your new Customer:
Create a permanent 100% discount by selecting Apply Coupon and following the New Coupon link to create a coupon that can then be applied to your Customer's account
Create a credit balance for your Customer by selecting Adjust Credit Balance and setting it to a sufficiently high value
I recommend the first as it allows for more control. In particular, coupons can be set to never expire, unlike credit balances that will eventually hit 0 and require you to remember to reset it.
To prevent abuse or avoid creating an exploit for potential attackers, you can even set the coupon to be redeemed only as many times as you intend to redeem it, preventing it from being applied by anyone who doesn't require it to test your Stripe integration. In the below screenshot, I've set it to be one-time use.

Related

Stripe - Any way to migrate off older Charges API (Subscriptions) without creating a Customer beforehand?

I am updating my billing page which used Stripe JS V2 tokens and the Charges API (Subscriptions). The new(er) Payment Element looks slick from a future proofing standpoint, but am I understanding it correctly that the Customer object must be created prior to populating the payment form?
I only create the Customer once the payment token is obtained and a user has a clear intent to purchase after evaluating during a trial period. Otherwise my Stripe Dashboard is overrun with "empty" trial users that never sign up (I only have around a 10% signup rate from account creation). I guess this is mostly just a personal peeve, but I also just don't like to share user data and figured this way I would only be sharing with a third party once they become actual customers of mine.
Since a Subscription cannot be created without providing a Customer as part of the required parameters, am I stuck using the Card Element and the older Charges API if I don't create a Customer for every user in my system?
You really should just create a Customer up front. It will be required if you want to use trials with Subscriptions and will be cleaner in the long run.
For a workaround, which I would not overall recommend, you could use a SetupIntent with Payment Element to collect the customer's payment method without actually creating a Customer object. Then you can later create the Customer object and attach the PaymentMethod that was previously collected and then create the Subscription.

Stripe Cross-Border Payouts Issues

I'm hoping that someone here can assist me with this issue. Stripe support has been underwhelming thus far.
We have a Primary Stripe Account setup in the US
We have customers that will be based out of MX that will connect to the US accounts.
From what we understand here: https://stripe.com/docs/connect/cross-border-payouts there are 2 main criteria that need to occur
We need to make these accounts "Custom"
We need to use the "recipient" option for the account's service agreement.
We also cannot request any other "Capabilities" such as "Card Payments" when setting this up.
Moreover, we have noticed that the moment we use the "Custom" option with Recipient agreement, customers do not have the ability to "Sign In" to their existing Stripe accounts even if they have one. The system always forces them to go through a "new" account setup process. Per Stripe, we are responsible for managing everything including verification of the customer and the customer is NEVER aware of the Stripe account's existence. This has been a hard pill to swallow for some of our larger customers who already have a Stripe account.
Say, we overcome that objection, and say people create new accounts. Now, we're running into a whole new series of problems.
We understand that Stripe requires us to perform separate charges and transfers. Great, we use transfer groups and transfer destination.
However, we also want to use the on_behalf_of parameter so that we attribute the transaction to the connected account for reasons explained here: https://stripe.com/docs/connect/charges-transfers#on-behalf-of
This is where the fun starts. It appears that if you use on_behalf_of, you cannot use "Automatic Payment Methods".
If you specify "card" as a manual payment method type, it will tell you:
You cannot create a charge with the on_behalf_of parameter set to a connected account with transfers but without the card_payments capability enabled.
However, the kicker is that we cannot request card_payments capability for the custom/restricted accounts. So this is a catch22.
So now, we cannot use On Behalf, and essentially, we're acting as the account of record, which is raising alarms in our accounting department.
In addition to that, our customers want to use OXXO, understandably so. This works fine in DEV mode, but when we enable Production, it tells us:
This payment method (oxxo) is not activated for the account specified in on_behalf_of. You can only create testmode oxxo PaymentIntents. You can learn more about this here https://support.stripe.com/questions/i-am-having-trouble-activating-a-payment-method
So, essentially, we are unable to use OXXO w/ or w/o on_behalf.
This makes us think if there are better ways to resolve this issue. We have been trying to get through to Stripe support and their responses have been circular, almost meaningless as they keep pointing us to the documentation and we keep poking holes in their documentation.
Am I missing something here? Looking to see if someone else has had these issues.
Cross-border Payouts as a feature allows US platforms to transfer funds around the world in more countries than Stripe officially in. For example you can accept payments from a customer on your platform and then sends funds to a connected account based in South Africa or South Korea even though Stripe doesn't (at the time of this answer) support those countries for payments.
The overall feature relies on a different type of "agreement" between you and the individual/business you are sending funds to. To do that you have to explicitly set recipient as the service_agreement parameter.
When you go down that path, you can not use on_behalf_of at all. Using on_behalf_of changes a lot of things such as where the payment is being "made from" which Stripe documents here. For that to happen in South Korea or South Africa, Stripe would have to be able to operate and accept payments there. But they can't, and that's why Cross-border Payouts exist in the first place: to let you send funds in countries where Stripe doesn't yet operate. So not using on_behalf_of is entirely expected.
Now, if you don't use on_behalf_of, what you are really doing here is accepting payments yourself, on your US account, through the US. So this limits you to the payment method types that Stripe supports for US accounts. This means you can not use Oxxo for Mexican customers or Konbini for Japanese one. This is a limitation that Stripe likely will lift over time but it's not available today. For example you can accept a lot of European payment methods from the US now which wasn't possible in 2019. In the future, those things will get easier, it's just not the case now.
What I don't fully understand, is why you would go down that path. You clearly say you don't want to be the "merchant of record", you want to do local acquiring, etc. My read is that you simply want to use Destination charges with on_behalf_of. This is supported from US platform to a MX account already. This is something Stripe already supports by default with the "default" services agreement.
While I tried to help with my knowledge, this is really something you have to discuss with Stripe's own support team. They are the only ones that can look at your account details, discuss your business model and understand if they can support you.

Stripe PaymentIntents + Subscription

Anyone know how to make a Stripe subscription charge a card automatically on future period payments using the new PaymentsIntent SCA approach?
Stripe's docs are in need of major pruning. I've never seen such convoluted and confusing docs as these ones.
One of the confusing parts is where they say in the docs for PaymentsIntents:
confirmation_method:
automatic
(Default) PaymentIntent can be confirmed using a publishable key. After next_actions are handled, no additional confirmation is required to complete the payment.
manual
All payment attempts must be made using a secret key. The PaymentIntent returns to the requires_confirmation state after handling next_actions, and requires your server to initiate each payment attempt with an explicit confirmation.
If I put automatic, the handleCardAction doesn't work anymore on the front end. If it has to be manual, does that mean that all future recurring payments (say Month 2, 3, etc) will need some kind of SCA confirmation by the user?
I haven't found any elements examples for paymentintents and subscriptions with SCA and varying plans and prices not pre-set on the backend as they depend on each individual's parameters.
If I use manual and handleCardAction, the subscription stays incomplete, despite the payment going through. If I use confirmCardPayment, the SCA popup never shows.
Looking further into the subscription and intent objects, I noticed that a new subscription created on the server comes with its own paymentIntent object. So does it mean one has to stop creating a separate paymentIntent with own id? If you do, it doesn't work for completing the subscription, which stays as incomplete.
However, the subscription's paymentIntent has a confirmation_method set as automatic by default -- this results in an error after SCA on the frontend: "You cannot confirm this PaymentIntent because it has already succeeded after being previously confirmed". Interesting, why did it ask for the SCA then in the status: "requires_action"?? Are we supposed to change manually the confirmation_method on a subscription to "manual"??
All this is quite confusing how to make subscription / paymentIntent work with SCA.
My logic is simple: user customises a subscription and enters card details, all of which gets sent to the server => Server creates a new plan, product, customer and subscription => Sends intent (from Subscription?) back to FE => If required, SCA is performed and the subscription is confirmed. Is this not how it's supposed to be done? I don't have pre-set plans as they can vary. I just need the ability to charge a user automatically the same amount they paid for the next period.
The examples and docs I've seen so far don't address the above use case. If anyone knows how to do it or can point to an example of how stripe elements and paymentIntents work with SCA and subscriptions that actually works and activates the subscription?
Stripe has a complete guide to fixed-price Subscriptions with Elements that sounds like it covers what you're trying to do.
When you're working with Stripe Billing (Subscriptions and Invoices) you rarely need to interact with the underlying Payment Intents; those are an implementation detail inside of each Invoice.

Can Stripe support Offline Payments?

I am using Stripe for online payments but also users can pay offline (cash or check). I want to centralize all my invoices/charges in one place (Stripe).
I am not sure if I can add offline payments (cash or check) to stripe or not. I guess I can if I created customers, invoices, charges with livemode=false for my live keys.
Is this feasible and will Stripe accept having some (customers, invoices and charges) with livemode=false and others with livemode=true?
If yes, should I fill fake credit card info or should I set it as nil?
Stripe does not allow you to create a Subscription on a Customer if you don't have a credit card setup. More accurately, it does not allow you to create a subscription if a customer does not have a way to pay for the next invoice. So for offline payments, you could update the 'account_balance' on the customer to have a negative value equal to the amount the customer wired (credits). Stripe will then allow you to create a subscription for the customer because it knows that the customer has enough account balance to pay for the next invoice. This post has more details.
We don't currently support offline payments, so you'll want to look at a separate accounting system for those payments.
That said, it's totally understandable that you'd want to keep this data in one place. You might be interested in using our webhooks system to offer live updates to your accounting system without directly touching the code that creates the charge in Stripe.

How to charge credit card AND set up automated recurring billing in one step with Authorize.Net

I’m integrating authorize.net into my web application. I’ve used the direct post method (DPM)to charge the account initially. However, for each transaction I also need to set up automated reoccurring billing. How would I go about doing this without asking for the information again, particularly when after DPM posts the initial transaction, the credit card data is no longer available?
I also would like to get the status of each reoccurring transaction so it can be confirmed and followed up on if necessary.
You can't do that with DPM as it takes the user's credit card information off of your website so you don't have access to it. If you want to make an initial payment and then use ARB to create a subscription you need to use AIM with ARB.
You need to use the ARB interface in order to do recurring transactions but there are a lot of problems with it, like lack of support (send an email and wait a couple of weeks for a non-helpful response for example) and weak documentation.
Documentation for SOAP interface for Authorize.net ARB:
http://www.authorize.net/support/ARB_SOAP_guide.pdf
And for the XMl interface:
http://www.authorize.net/support/ARB_guide.pdf
ARB programming documentation:
http://developer.authorize.net/api/arb/
I just switched off of Authorize.net to USAEPAY. Here are some reasons why:
1. When you use Authorize.net ARB, your customer comes on the site to sign up, and you send the ARB request to create the subscription and you get back a success code so you give the user the subscription. Then later that night they actually try to collect the first payment and a lot of times this fails, so you get a spreadsheet emailed to you the next day about the problem. This is terrible because now you lost the opportunity to say to the customer at sign up time that the card is declined. Goodbye sale!
2. I don't know if they added this recently but they didn't have a way to verify if a customer's credit card is still valid. Imagine 3 months into a subscription the card is over the limit, or cancelled, or expired etc. You don't know so how do you prompt the customer to put in a new card? You just stop getting paid, unless you want to manually open these spreadsheets and start emailing customers. YUCK.
USAEPAY works much better, the API is easier, its much better documented and you get email responses in 1-2 days and its less expensive. For example, you can query USAEPAY to get a list of successful payments, and verify that you shouldn't deactivate the account for non-payment:
http://wiki.usaepay.com/developer/soap-1.4/methods/getcustomerreport
Before you go too far with AuthNet I highly encourage you to save yourself a lot of pain and contact FranchisePaymentNetwork (FPN) to get set up with USAEpay.
They can even POST BACK to your website to let you know if a transaction is successful or not for recurring billing transactions and you can query it to verify that customer payments are getting collected so you know if you should expire an account or not.
I am not affiliated with USAEpay or Franchise Payment Network except as a satisfied paying customer / consumer of their services.

Resources