I want to use zoho subscriptions to make recurring payments on my website.
I use webhooks to send data for creating membership.
Now I want to validate the data from webhook to check if the webhook was really sent.
You should read webhooks data and validate by Zoho signature after that, check the event_type which indicates the event, it could be subscription_cancelled, subscription_cancellation_scheduled, new_subscription. Also, you should get a subscription id, customer id inside of data->subscription->. Below a sample webhooks body
{
"created_time":"...",
"event_id":"...",
"event_type":"...",
"event_source":"...",
"event_time":"...",
"data": {
"subscription": {
"subscription_id": "...",
"created_time": "...",
"customer_id":"...",
"...": "..."
}
}
}
Now, you have a subscription id, customer id, you can call Zoho subscription info API to get subscription details for cross-checking. Another way, you have event_id so, now, you can retrieve event details to validate that webhooks really comes from Zoho.
Related
I'm using Stripe to handle payments for a subscription service I'm setting up.
I gather the relevant information from my customer, then on the server side, I use the Stripe PHP IDE to set up a new customer and create a checkout session for a price object which I've set up as a subscription. I save the checkout session ID to my database, then use that same session ID client side to take payment from the customer, via a redirect to Stripe.
The webhook checkout.session.completed, then lets me link up the previous checkout session ID with the subscription ID. Then I need the second webhook customer.subscription.updated to get the status of the subscription from the subscription id.
It feels like I'm doing something wrong here. I'm using two webhooks to get the information I need. If the checkout.session.completed webhook were to arrive after the customer.subscription.updated webhook, then my logic will fail.
Is there a better/correct way to manage this flow?
You only need checkout.session.completed here. That event indicates a successful Checkout and payment.
I would ignore the initial customer.subscription.updated event and instead, if you need that status, fetch the Subscription with https://stripe.com/docs/api/subscriptions/retrieve when you receive the checkout.session.completed event.
I am creating a Shopify app using PHP. For starting I am following this skeleton and after some debugging I am able to setup it and install.
I need to register some web-hooks through my app installation but I can't find any reference for the same.
I need to register the webhooks like when some new customer register, order place etc. How can I register those webhooks through the app?
I know we can register the web-hooks form Shopify admin manually, but I need to register them through app.
Just make a POST request to the "/admin/webhooks.json" endpoint with following data:
{
"webhook": {
"topic": "orders\/create",
"address": "http://www.example.com/create-order-webhook",
"format": "json"
}
}
this will register the webhook and fire the webhook to http://www.example.com/create-order-webhook address with order details whenever a new order is created.
you can get the number of registered webhooks:
GET /admin/webhooks/count.json
Hide Response
HTTP/1.1 200 OK
{
"count": 2
}
Also note that you need to quickly respond with status of 200, so whatever task you need to do, do in background and also you may need to verify that webhook was fired from shopify only.
I receive a hook from Clickfunnels that contains a "subscription_id": "sub_AnDOcr3inf0Qfx". How can I get all payments of this subscription using this data? Will be very appreciated for any help.
You can list all Invoices for the given Customer and Subscription and each of those will have a charge property that you can then retrieve (or you could just expand it for your 'list Invoices' API call).
There are a lot of discussions about similar issues but I couldn’t find the exact answer.
Here is the problem:
I’m trying to integrate in-app payment in Android OS using the latest PayPal MSDK library. The integration was straight forward, I could make successful single payment, receive proper response and the things was OK until I have to verify the mobile payment
In the mobile app(using PayPalConfiguration.ENVIRONMENT_SANDBOX), I receive the following response:
{
"client": {
"environment": "sandbox",
"paypal_sdk_version": "2.2.2",
"platform": "Android",
"product_name": "PayPal-Android-SDK"
},
"response": {
"create_time": "2014-08-05T19:49:19Z",
"id": "PAY-0D205735ER3716140KPQTKPY",
"intent": "sale",
"state": "approved"
},
"response_type": "payment"
}
As you can see, the transaction ID is: PAY-0D205735ER3716140KPQTKPY
When I try to verify the payment by making request with this transaction ID from my server to PayPal, the response is always the same:
{
"Errors":
[
{
"L_ERRORCODE":"10004",
"L_SHORTMESSAGE":"Transaction refused because of an invalid argument. See additional error messages for details.",
"L_LONGMESSAGE":"The transaction id is not valid",
"L_SEVERITYCODE":"Error"
}
]
}
When I check in PayPal Sandbox test account site -> Notifications, the test transactions ids are completely different. For the above transaction, the transaction id is:
5DY75733624918945
If I use this transaction ID in my verification request – the response from the PayPal is OK.
According the documentation, I should use the id from the mobile app response (moreover – I do not know other way to retrieve a transaction id…).
I'm using a test sandbox account, tried with different type of payment (PayPal button and CC), tried even with real transactions - the result is the same.
Do you guys know why they are different?
Please take a closer look at https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/
The SDK returns a payment ID which can be used to retrieve a payment resource using GET. The payment will contain one or more transactions (in your case, a single sale transaction) in the related_resources section.
I want my customers to get notified if the recurring payments fail on Stripe. They should be notified via email that Stripe has declined their Credit Card. I have read about webhooks but not quite sure how to use them. And also how can I know every time any card has been declined on Stripe.com?
The idea with webhooks is that you register a url with the remote party and once they have something to tell you they "call" that url passing it parameters.
With stripe you do that on their dashboard under webhook settings.
Then all you have to do is apply your logic in the url you supplied. If it is www.example.com/webhooks/stripe then you need a webhook controller with a stripe() method that will parse the data.
So in your stripe() method you wait for the charge.fail event (read Stripe's API) and once you get that you send the email and perhaps update your database as well.