Hi I've been working on a new site in modx and wanted to use Stripe Checkout for a very simple way to take payments.
Stripe Checkout gives a really easy 'Simple' way to integrate, but unfortunately it doesn't work with Subscription/Recurring Payments!!
So I'm stuck with the 'Custom' option instead.
It should be fairly easy to set up but I'm not clear from their documentation what I'm really supposed to do to actually get it working, or what I need to add to Modx...
I've started with their 'Custom' example code:
https://stripe.com/docs/checkout#integration-custom
Putting it on the page I'd like to take the payment:
<script src="https://checkout.stripe.com/checkout.js"></script>
<button id="customButton">Purchase</button>
<script>
var handler = StripeCheckout.configure({
key: 'pk_test_6pRNASCoBOKtIshFeQd4XMUh',
image: 'https://stripe.com/img/documentation/checkout/marketplace.png',
locale: 'auto',
token: function(token) {
// You can access the token ID with `token.id`.
// Get the token ID to your server-side code for use.
}
});
document.getElementById('customButton').addEventListener('click', function(e) {
// Open Checkout with further options:
handler.open({
name: 'Stripe.com',
description: '2 widgets',
zipCode: true,
amount: 2000
});
e.preventDefault();
});
// Close Checkout on page navigation:
window.addEventListener('popstate', function() {
handler.close();
});
</script>
adding this to my page works and when I click the Pay button a popup appears and takes the card info etc in test mode. But I'm not sure how I now change this to recurring payments as well as also pass the user to Payment Confirmation resource. Also how do I know the payment actually worked?
The documentation also mentions I need to set up a client library and use this guide for Subscriptons:
https://stripe.com/docs/subscriptions/quickstart
But how does this tie in with the custom code I already have and how do I bring it all together. Apologies for my ignorance on this and thanks very much for any help at all. I'm sure a lot of users would benefit or find a solution to setting up recurring payments with this on modx.
Thanks again