stripe-payments
Stripe Connect: What’s the difference between Customers and Accounts?
When developing a Platform there are two functions you’re generally interested in: paying out and taking payment from users. Stripe divides these functions up into two separate object types. Accounts An Account is an object to represent a user that you pay out to. An account can have an External Account (a bank account, or … Read more
Is the customer.subscription.updated event raised when a subscription is renewed?
I’ve verified that customer.subscription.updated is called when the billing period ends. To do this I intercepted all webhooks that occur at the end of the period (FYI: I used an AWS Lambda function that receives the events from an AWS API Gateway, then puts the events on an SQS queue :)) I agree that the … Read more
Stripe Checkout example running into CORS error from localhost
Here are some of the things I learned while trying to debug this. Stripe checkout uses AWS Cloudfront and it does not allow options requests (as per Stripe’s config) OPTIONS request are not sent to Stripe when I change the request type in the frontend to text/plain. (Yes, that’s right, after my server returns the … Read more
Modify style of ‘Pay with Card’ Stripe button
None of those worked for me. I ended up hiding the button in javascript and making a new one. <form action=”/your-server-side-code” method=”POST”> <script src=”https://checkout.stripe.com/checkout.js” class=”stripe-button” data-key=”xxx” data-amount=”999″ data-name=”zzz” data-locale=”auto”> </script> <script> // Hide default stripe button, be careful there if you // have more than 1 button of that class document.getElementsByClassName(“stripe-button-el”)[0].style.display = ‘none’; </script> <button … Read more
Stripe Webhook events Renewal of subscription
The webhook ‘invoice.payment_succeeded’ actually does distinguish between the first charge of a new subscription and subsequent renewal charges. The webhook sends an invoice object, which includes ‘billing_reason’ – the possible values of which are noted in the Stripe Docs – The Invoice object: billing_reason (string) “Indicates the reason why the invoice was created. subscription_cycle indicates … Read more
Stripe – Add new card to existing customer
If you are on the 2015-02-18 API version or later then the cards attribute has been changed to sources as you can see in the changelog The documentation on the Create Card API shows the following code now: customer = stripe.Customer.retrieve(‘cus_xxxxxxxxxx’) customer.sources.create(card=card_token) You can find your API version in the API keys settings in the … Read more
How to pre-populate email in the Stripe payments dialog popup
If you’re using Simple Checkout you pass the email in data-email like this: <form action=”/charge” method=”POST”> <script src=”https://checkout.stripe.com/checkout.js” class=”stripe-button” data-key=”pk_test_6pRNASCoBOKtIshFeQd4XMUh” data-image=”/img/documentation/checkout/marketplace.png” data-name=”Stripe.com” data-description=”2 widgets” data-amount=”2000″ data-email=”[email protected]” data-locale=”auto”> </script> </form> If you’re using Custom Checkout you pass the email in the email parameter to handler.open(): handler.open({ name: ‘Stripe.com’, description: ‘2 widgets’, amount: 2000, email: “[email protected]” });
Stripe payment example is not displaying
Don’t add the script in the head, instead, add it right before you close the body. <html lang= “en”> <head> <meta charset=”utf-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1″> <title>test</title> </head> <body> <form action=”/charge” method=”post” id=”payment-form”> <div class=”form-row”> <label for=”card-element”> Credit or debit card </label> <div id=”card-element”> <!– a Stripe Element will be inserted here. … Read more