Get to know when paypal made payment in subscriptions plan - reactjs

I'm using paypal subscription plan which is define here Subscription Integration I'm using reactjs here is package which I'm using for paypal react-paypal-button-v2 I'm successfully able to make payment but problem is I'm setting subscription plan which make payment every month. So how can I get to know when paypal made payment for next month. Is there some webhook or callback url which is called everytime when paypal made payment for this specific subscription plan. If there is how can I set any guide or something ?

Store a record of the subscriptionID when it is first created. Typically you'll want to associate this with a user.
For keeping track of future payments, set up a webhook listener for PAYMENT.SALE.COMPLETED events.

Webhook PAYMENT.SALE.COMPLETED has subscription id named billing_agreement_id.
(if this webhook was triggered as a result of a subscription payment)
Ex: webhook body like
{
...
...
resource: {
"billing_agreement_id":"I-XXXXXXXXX"
}
}

Related

How to finalise one-time payment summary with Firebase Extension "Run Payments with Stripe" on a ReactJs website

I'm currently using Firebase for my ReactJs website.
I wanted to use stripe to add a payment module. So I created an account on Stripe and added the extension "Run Payments with Stripe" on my Firebase project.
Everything works fine on this extension on my website:
I can make payment
I'm well redirected to the Stripe payment interface
The webhook add the payment document on my customer document on Firestore
But, I have one problem remaining : how to know which firestore document payment was concerned by the one-time payment a customer make on the current checkout session?
Firestore does not update checkout session document with the payment id, or the payment document with the checkout session id.
I tried to update manually the webhook function on Google Cloud but I don't think that's a good idea (and I don't know why but the update was not considered).
I don't want to list all payment the customer made and displayed it : I want to have this specific payment and display a summary of this order.
Does someone has clues on this?
Yup, it appears that the function in the webhook handler does not add Checkout Session data with the associated Firestore payment document.
I'd recommend creating an issue on the GitHub repository with your feedback/request. Alternatively you can configure a 2nd webhook to update the Firestore documents as you need.

MS Call record subscription

I am setting up webhooks for Teams call records mentioned in https://learn.microsoft.com/en-us/graph/api/callrecords-callrecord-get?view=graph-rest-1.0&tabs=http .
My doubt is related to statement "Subscribe to change notifications to the /communications/callRecords endpoint.".
Can we use same notification url for multiple accounts with different tenant id ?
or Can we use same notification url for completely different organizations ?
There is no technical constraint preventing us from using the same webhook endpoint.
The webhook just needs to read the tenantId field to route notifications appropriately. Note that each tenant does need its own subscription, but they can all have the same notificationUrl.

Is it possible to pass subscription specific parameters to API called?

I am using Azure API Management.
I have create an API, a product and a subscription
The API is generic. it does a lookup of sales order history and requires a customer id to show that customers orders onyl. The relation between customer and subscription is intended as 1:1.
However I dont want subscribers to see other subscribers data. I thought, I could set a fixed parameter (e.g. customer id) to each subscription to be passed to the API on any call.
Or how can limit API to be only show subscriber specific data? Somehow the API has to differentiate between subscriber. Any idea?
When calling an API using a subscription key, the context.Subscription and context.User (not for standalone subscriptions) are set for use in policies.
Since you have a 1:1 relation between customer and subscription, you could set a header in the request to the backend with the user's email using the below policy statement in the inbound policy section
<set-header name="x-customer-email" exists-action="override">
<value>#(context.User.Email)</value>
</set-header>

Create custom paypal button with link direct after payment

I am trying to create a custom paypal button for selling digital goods, that will direct the buyer to a link that will allow him to download the file.
I've read a bit this paypal article about advanced html variables but I am not sure which I have to use to make it work: https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
Obviously the download should only initiate based on the payment ID to prevent free downloads, or is that done automatically by paypal?
What I would recommend us utilizing Instant Payment Notification (IPN) to handle all your post-payment processing tasks like updating your database, sending out email notifications (including one with a download link), etc.
Instant Payment Notification (IPN) is a message service that notifies
you of events related to PayPal transactions. You can use IPN messages
to automate back-office and administrative functions, such as
fulfilling orders, tracking customers, and providing status and other
transaction-related information.
This will allow you to not only automate the procedures, but also correctly handle things like e-checks or any other type of payment that may originally be in a "pending" status. You wouldn't want to deliver the digital goods until that payment actually clears. With IPN you will get 1 notification that your script can handle when the payment comes through as pending, and you would get another one when the payment updates to Completed, or Failed, or whatever.
The IPN's happen in real-time so buyers won't have to wait on anything. Whatever you're doing within the script would happen instantly upon the transaction completing.

How get monthly alerts of payments process of monthly subscriptions on Authorize.net?

I am using ARB method of authorize.net for monthly subscription. I am getting successful response on sandbox account.
How can I get alert on monthly bases when authorize.net perform next month payment deduction for subscription, so I can maintain record in database for the payments of any user monthly subscription?
If you want of be notified of subscription payments you can do one of two things:
Use Silent Post. Authorize.Net can send a POST request with payment data for all successful subscription payments to a URL that you specify. The data contained here will be identical to the response from a request made via their AIM API. Keep in mind that this only supports successful transactions. If a transaction fails you will not be notified.
Use Webhooks. A webhook is a notification that something happened. You can subscribe to webhook notifications that you care about, in your case anything related to subscriptions, and ignore ones that you don't. You do need to take an extra step as the webhook notification won't include much detail about the transaction so you will then need to query their API to get the transaction results, but it will notify you of all subscription payments including when one is declined, a subscription is suspended, or a subscription is expiring.

Resources