PayPal Rest API - Sandbox Recurring Subscription Webhook Notifications - paypal

I am implementing recurring subscriptions using the Paypal Rest API. In Sandbox mode, I subscribed to all Webhook events, with the the target in mind that I will receive notifications such as when the plan and agreement are created, as well as when the recurring billing takes place. Whilst I am receiving the notifications for the plan and agreement, I am not receiving any notifications for the daily billing that is supposed to take place. The 'payment_definitions' section of the: Billing Plan created notification can be seen below. It clearly states that the frequency is: Day and frequency_interval is 1.
"payment_definitions": [
{
"name": "Standard Plan",
"type": "REGULAR",
"frequency": "Day",
"frequency_interval": "1",
"amount": {
"currency": "EUR",
"value": "40"
},
"cycles": "11",
"charge_models": [],
"id": "PD-01A711327R015545F37WM7QI"
}
],
I was under the impression that a notification such PAYMENT.SALE.COMPLETED can and should be used in the Webhook listener to extend the user's subscription on a monthly basis (I am using 'DAY' frequency just for testing purposes, for the time being).
Is this the way it should work? Perhaps, there should be no Webhook notification when the scheduled billing takes place? Perhaps such a model is what should be used: a yearly subscription is given, and if no cancelled notification takes place it is simply left to run out its course?
Or does it just not work in Sandbox, perhaps? Note than in the Webhook logs within the PayPal developer, the only notifications present are related to Billing Plan Created and Billing Subscription Created. There are several instances done on the 17th and 19th April, so there should have been at least 4 notifications of daily billing ever since.

Related

PayPal Commerce Platform - Where does the platform fee go?

I'm back with a paypal issue. I've managed to finally capture payments where I've set a platform_fee to be deducted from the total sale. It does deduct the set platform_fee from the amount that the seller receives (listed as platform fee). The completed transaction's response (as well as the GET order's response) show that the transaction fee was sent to the merchant_id of the marketplace platform's sandbox account. However it looks strange to me that the email address attached to it is correct except it is prefixed with "cs-".
Here's a snippet from the response when I capture the payment:
"payment_instruction": {
"platform_fees": [
{
"amount": {
"currency_code": "GBP",
"value": "50.00"
},
"payee": {
"email_address": "cs-sb-5ncon7179067#business.example.com",
"merchant_id": "3P2BRV2QKVZ22"
}
}
],
"disbursement_mode": "INSTANT"
},
Now, the money is all accounted for EXCEPT for the platform fee; I can't see it in my expected sandbox account. I've tried this on a fresh developer account/platform as well, with the same result. One of the accounts I've tried this on is also an approved paypal partner.
I've also tried changing the parameters (as it solved my previous issue) by setting the payee to email, to merchant id, and to default. It all points to the platform's sandbox account, but it doesn't appear in the wallet. I've also made sure my sellers are onboarded with the PARTNER_FEE feature.
Do you have an idea of where I can check this? I don't see it in the activities area of the sandbox account. Thank you.
In the sandbox environment, the partner fee disappears. It goes nowhere and you won't see it end up anywhere.
For the live environment, the partner fee does not go to the partner PayPal account. Rather, it goes directly to the bank account that the partner has set up for this settlement. Contact your partner relationship manager at PayPal for details on changing the bank if needed.

Paypal Missing Payer Address with Orders API V2 / Sandbox

I am setting up a payment integration with PayPal Checkout Buttons and Paypal Orders API V2, which I test in the sandbox environment (no fancy shop system in use).
When an order is paid and status is completed, the Paypal Orders API V2 returns a valid response, but I do not completely receive the payer address from my sandbox buyer account.
Payer looks like this:
"payer": {
"name": {
"given_name": "<given_name>",
"surname": "<surname>"
},
"email_address": "<email>",
"payer_id": "HEU6X43KU231",
"address": {
"country_code": "DE"
}
}
but the payer definition says that the payer should also contain:
address_line_1,
address_line_2,
admin_area_1,
postal code
I would like to use this information to send an invoice to the customer after payment is completed.
First, I thought, the address information is not available in my sandbox buyer account, because you do not find this information in the paypal dashboard (in the details of the respective sandbox account), but the address information is available at https://www.sandbox.paypal.com/businessprofile/settings/address
The whole thing would work with a shipping address, but this look like conceptual mismatch. My order item has the "category": 'DIGITAL_GOODS' and I've set the "shipping_preference": 'NO_SHIPPING', because I sell a digital product, which is automatically delivered after the payment process.
As a workaround I could also ask for the address information in the dialog in our part of the order process (in our GUI, before checkout), and prefill the paypal payment dialog with the userdata entered in our GUI, but in terms of user experience I would prefer to use the paypal data.
Does someone have a clue how to receive the payer address data?
Thanks a lot in advance
I will get the documentation clarified.
But to just answer your question, by default the address of the payer is not shared, just the country_code - to get the complete payer.address you will need to call your account manager or merchant support and they can enable it for your account if you meet their criteria.

PayPal\Api\Payment - getState()

I have a question regarding states:
The API says the following:
getState( )
The state of the payment, authorization, or order transaction.
The value is:
created: The transaction was successfully created.
approved: The buyer approved the transaction.
failed: The transaction request failed.
–––
What does approved actually mean ?
Is the money already on my PayPal account ?
Can it be canceled by the Payer after the status is approved (fraud) ?
The question is now, is it safe to ship the product when the status is approved?
Is that enough or do I need to use a Webhook or IPN ?
Here is an example response for my current sandbox setup:
https://gist.github.com/daslicht/795dceae24740d5ca3330cd2066c38bb
And then here:
https://gist.github.com/daslicht/795dceae24740d5ca3330cd2066c38bb#file-gistfile1-txt-L65
There is another state which says "completed"
~ Marc
Finally Paypal Answered my Question:
The "approved" state just means the buyer logged into their account and approved the payment. You still need to execute the payment request, which once you do check the "state" shown in the "related_resources" section and it should say "completed", which indicates the transaction amount has been captured. The "id" shown below is the transaction identifier.
"related_resources": [
{
"sale": {
"id": "6CP443382P136134L",
"state": "completed",
"amount": {
"total": "7.47",
"currency": "USD",
Hope that helps someone else and saves time waiting for a response from paypal

Can I sell PayPal product with BlueSnap and charge it later that day for additional cost?

I use BlueSnap API to sell products, using PayPal. In my website, I send the shoppers to PayPal without them filling-in any shipping details - once they log in to PayPal I get those details from their BlueSnap account.
But the problem is that I don't know where the shoppers are located before sending them to PayPal, so there's the issue of shipping and tax that may need to be added on top of the product price.
Is there any way for me to send the shopper to PayPal for a certain amount – let's say $50 - and later according to the shipping details add a $7 surcharge without the shopper re-approving the deal?
I usually use this Payment API call:
{
"amount": 50,
"softDescriptor": "My SD",
"currency": "USD",
"paypalTransaction": {
"cancelUrl": "http://www.cancelURL.com",
"returnUrl": "http://www.returnURL.com"
},
"transactionFraudInfo": {"fraudSessionId": 1234}
}
There's no obvious spot for potential surcharge, so I'm not sure if that's even possible – and what are the limitations? I read this documentation and couldn't get a clear picture. https://developers.bluesnap.com/v8976-JSON/docs/create-paypal-transaction
I'd appreciate any help!
BlueSnap has a few flows to handle PayPal purchases – and from what you're describing, it looks like the split-step PayPal flow should work for you. When you send the request via the API, simply send this (POST):
{
"merchantTransactionId": "mysurchagetransaction",
"softDescriptor": "SOFTDESC",
"amount": "50.00",
"currency": "USD",
"payerInfo": {
"firstName": "John",
"lastName": "Doe"
},
"paypalTransaction": {
"transactionType": "AUTH_ONLY",
"returnUrl": "http://www.returnURL.com",
"cancelUrl": "http://www.cancelURL.com",
"maxAmount": "70.00"
}
}
The $70 is your limit – you can go as high as 40% more than the amount, otherwise BlueSnap will not allow the transaction. The idea is that at this point, you want to send the Shopper to PayPal for a $50 purchase – but you expect a potential surcharge once you know where they're from, up to $70 potentially. The response to this API call will include the order ID (keep it for later!), as well as the usual redirect link to PayPal. Your shopper will be redirected there, approve $50 and then be redirected again to your returnURL (your website).
When the shopper returns, you get a BlueSnap shopper ID – and it will have all the shipping data taken from PayPal. To look at the data, you can retrieve the shopper the usual way: https://developers.bluesnap.com/v8976-JSON/docs/retrieve-vaulted-shopper.
Now comes the second step, which is recommended to take place within a few hours (PayPal has a time window). You consider the shopper's shipping address for tax/shipping surcharges, and then you send this capture funds API call (PUT):
{
"amount": "58.00",
"currency": "USD",
"paypalTransaction": {
"orderId": "4006145",
"transactionType": "CAPTURE"
}
}
Note that you chose to charge $58, so you didn't use your full $70 max amount. That's fine, and the shopper will have no record in PayPal of the $70 you considered charging – just the $58. Also, the shopper didn't have to re-approve the purchase, or login again to PayPal. Although it isn't mandatory, I would recommend you tell the shopper the amount you plan to charge when they return to your website – if it's applicable to the flow of your site.
I hope I helped!

Paypal : We are not able to process payment using PayPal account at this time. Please return to the merchant

I'm trying to accept Paypal payments and i used Express Checkout C# SDK.
But when i'm trying to do a payment, i'm getting a paypal page with this message
"We are not able to process payment using PayPal account at this time. Please return to the merchant" and a button to return to merchant site (cancel url)".
Automatically created accounts (country FR) are not working so i tried to create US accounts not working too. All my accounts are verified.
I tried also to clean my browser cookies (see this post)
Does anyone have a guess ?
Thanks
I am having a similar problem. What I noticed is that if the buyer test account only has a credit card as funding option, then I get the error as soon as I login with the test account. If, on the other hand, the test account also has a Banking Account funding option, then the login succeeds, but I can only choose the Banking Account option and not the credit card to complete the payment.
If in your case you don't need to test the credit card option, perhaps this could be a solution.
Also, on the official PayPal documentation I read that, in order to accept credit cards, you need to upgrade the business account to a Pro account:
https://developer.paypal.com/docs/classic/lifecycle/sb_about-accounts/
I tried that, but it did not help in my case
The simple solution is add "allowed_payment_method": "INSTANT_FUNDING_SOURCE"
"transactions": [
{
"amount": {
"total": data.grandTotal,
"currency": "AUD",
"details": {
"subtotal": (data.subTotal - totalDiscount).toFixed(2),
"shipping": data.shipping,
"handling_fee": data.handling,
"insurance": data.insurance
}
},
"description": "My orders",
"payment_options": {
"allowed_payment_method": "INSTANT_FUNDING_SOURCE"
},