Use GoCardless payments with Zapier - webhooks

I'm trying to use Zapier to update Google Sheets with payment information from GoCardless. I can't see anything in the received event webhook that I can use to match a payment to a customer though.
events:
1:
id: EVTExxx8B
created_at: 2021-03-29T21:57:38.658Z
resource_type: payments
action: confirmed
links:
payment: indxxx23
details
origin: gocardless
cause: payment_confirmed
bank_account_id: BA00xxx9N
description: Enough time has passed since the payment was submitted for the banks to
return an error, so this payment is now confirmed.
metadata:
meta:
webhook_id: WB00xxxQTY
querystring:
I presume I need to match one of these IDs against the list of customers via the API but I'm a bit stuck on how to do this with Zapier. I can't find anything in the documentation to help (that I understand at least anyway). Has anyone managed to achieve anything similar please? Many thanks.

Not a full answer as I am not familiar with the details of Zapier, but this might point you in the right direction.
You can use the payment link (events -> links -> payment) to get the payment resource from their API, which will have a mandate link, which you might have saved somewhere. If not saved, you will need yet another query on the mandate which will give you the associated customer.

Related

Is it okay to have a bunch of incomplete Stripe payment intents?

I am implementing the Stripe payment platform using JavaScript and the PHP SDK.
I don't have any issues with the implementation itself, but I am not sure whether I have to reuse an existing PaymentIntent or it's perfectly fine to have a bunch of them created and incomplete.
I searched for this in Stripe's documentation, but I can't seem to find anything related to this.
For example, in my test account I have this:
It's all for the same transaction, because I was changing some visuals and refreshing the browser.
I am aware that each PaymentIntent has an ID, but is it recommended to add it as a query parameter and retrieve it on refreshing, or is it better to always generate a new Payment Intent.
My main reasoning is to avoid having a huge collection of incomplete payment intents.
The default integration path for Stripe today is to create a PaymentIntent first so that you get a client_secret you can use client-side to render their UI via PaymentElement. This means that if your customers decide not to pay after all, you end up with an incomplete PaymentIntent which is expected.
This is not really a problem, other than appearing in the Payments list which can be confusing. You could also write a background job daily that would cancel any PaymentIntent via you know won't be completed because the customer left and you didn't have any data to contact them to upsell them for example but this isn't really needed.
Stripe also has a beta (docs) right now (Feb 2023) that changes the default integration path. This simplifies the experience because you can render the PaymentElement client-side with specific options such as amount and currency. You'd then only create the PaymentIntent at the end of the flow
when the customer is attempting to pay. That flow limits the number of incomplete PaymentIntents since you only create them when the customer really pays. You'd still get some, for example after a decline by the customer's bank though.

Online payment - trigger on event

Im looking for some advice in relation to a solution that allows a payment to be triggered on a specific event, automatically.
Step 1: User signs up to make a charity donation (provides banking information)
Step 2: On triggering a certain event, a $1 donation is automatically made to the charity from the user
Step 3: A receipt generated back to the user, and also to the charity.
Step 2 would need to trigger each time the event happens, so although it could be $1, the event might happen 3 times, and therefore 3 payments would be made.
I'm looking at something like Stripe as the payment gateway provider, just not sure if I'm looking for the right kind of solution, and whether there is something else Ive not come across already.
Alternatively I would look at collating all occurrences of the event, and send a monthly payment link (which appears to be much simpler approach).
Any help would be appreciated, as Im looking to automate donations for a particular charity in the UK.
Very grateful for any advice anyone is willing to share. Thanks everyone.
Focusing on your overall goal, I believe you could use this [1] flow from Stripe which allows you to collect payment method information from your users and charge them later (whenever you want) by calling the API.
The idea here would be that whenever your "event" is triggered, you code calls the API and charges the saved payment method.
I can't provide a more thorough/specific suggestion since "event" term here is quite vague. Is this "event" time driven (like a subscription) OR something else?
[1] https://stripe.com/docs/payments/save-and-reuse

how to add coupons to stripe's checkout

To enable SCA changes, I am now integrating https://stripe.com/docs/payments/checkout/client stripe's (stripe v3 js file) checkout feature to my app, which makes it easy for integration of my subscription system.
Question
how to pass coupons to stripe.redirectToCheckout() method, don't see anything related to this in documentation.
code sample
stripe.redirectToCheckout({
items: plans_and_addons,
successUrl: successUrl,
cancelUrl: cancelUrl,
clientReferenceId: customer_id, // helpful in webhook response
})
I am also facing the same issue so I contacted stripe support.
Please check the support team's reply.
I did a thorough research on your query and I'm afraid, Checkout supports only a limited set of customizations (e.g. name, description, logo) and fields. Focusing the UI allows us to iterate on it more effectively to improve conversions and maintain support across a wide range of platforms.
They provided me one document link you can also check it. https://stripe.com/docs/payments/checkout/customization
I think you can solve your problem by creating custom checkout with helping stipe API. --not tried.
As Daniel says above, you can't enable the promo codes when you call redirectToCheckout but you can enable the promo codes when you create the stripe session from your API.
So, to sum app, when you create the checkout session using Stripe.checkout.sessions.create() you have to also pass the allow_promotion_codes: true and this will actually allow you to apply promo codes to the products you have created in the stripe -> products page.
You can find more informations on this page: https://stripe.com/docs/billing/subscriptions/coupons/codes
I also ran into this, and what I've deduced from the Stripe docs is that you can't apply a coupon directly to the redirectToCheckout method, you have to create a Checkout session first and then use that.
Add a discount to Checkout the sample code is calling Checkout.session.create, not Checkout directly
redirectToCheckout Reference Docs doesn't mention a discount or coupon parameter at all, and the sample code again is creating a Checkout session using fetch (to one's own server backend, which is where my expertise ceases and where I'm stifled), to generate a session ID and then passing that into the result where redirectToCheckout is called.

Stripe receipt url

From the Stripe dashboard I can view a receipt (click preview link in invoice details). The receipt is then shown inside a popup but there is a permalink in it, so it can be viewed as a separate page. The URL of an emailed receipt looks like this:
https://dashboard.stripe.com/emails/receipts/invrc_xxxxxxxxxxxx
This URL does not require authentication, and so would be perfect for allowing me to show links to receipt details from inside my app's billing page. Except that there seems to be no way to get the magical invrc_xxxxxxxxxxxx id from the API, so I am unable construct the URL.
Or for some strange reason, Stripe engineers went through the trouble of designing an unauthenticated receipt view page, but have decided not to expose it via the API. Why??
This issue has been brought up in Stripe API - Receipts Listing (see comments section at the bottom), but no explanation, solution or justification was provided. Hope this more specific question can help.
UPDATE: As of January 17 2019, this is now possible to do. The Charge object has the receipt_url property that lets you access this information whether an email receipt was sent or not!
That's unfortunately not something currently supported. There isn't any way through the API to get an receipt ID to be used here. That endpoint was built with the intent that it would only be used to permalink to a receipt from the body of a receipt email. That said, we are considering building out this functionality at some point in the future.
EDIT: Looks like my colleagues in Stripe support beat me to the punch here.
UPDATE: as of 2019-01-17, this is now supported via the receipt_url property on Charges (https://stripe.com/docs/api/charges/object#charge_object-receipt_url).
The invoice object has attributes for this:
hosted_invoice_url - string - The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null.
invoice_pdf - string - The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.
Solved using screenshot API
If you are using React try this but you can just use the ajax request to show the receipt in your app
const [recipt, setrecipt] = useState({loading: false,img: '',});
get the url from the strip response receipt_url
const url = receipt_url
const result = await axios.get(`https://screenshotapi.net/api/v1/screenshot url=${url}&token=yourtokenhere`,);
then you can find the png URL from result.data.screenshot
then you can use img tag to display it make sure to replace token with yours
Is this to resend a new email? There is an option send emails to the customer in the settings on successful payment. Another idea is to have the email send to something like Mandrill for processing and extract the URL:
http://help.mandrill.com/entries/21699367-Inbound-Email-Processing-Overview

UML Event Tables: Differences between Event & Trigger, Intermidiate Responses

Suppose the event/use-case "Buy Online", in the event table, the entry may look like
Event: Customer buys products online
Trigger: Same as Event?
Source: Customer
Use Case: Buy Online
Response: Confirmation Code, Validate Credit Card
Destination: Customer, Payment Verification System
If a Payment Verification System is called in the process to Validate Credit Card, do I include it? It isit the final response?
No, it is not the final response, but only a part of this use case.
The Validate Credit Card is an extension (not an include) of the main use case, as it is optional (there are other way to pay online).

Resources