PayPal Adaptive Chained Payments: How to hide Secondary Receivers from Sender? - paypal

Documentation says:
Chained payments are useful in cases when the primary receiver acts as
an agent for other receivers. The sender deals only with the primary
receiver and does not know about the secondary receivers, including
how a payment is split among receivers.
I'm doing this request:
{
"returnUrl": "http://localhost",
"currencyCode": "USD",
"receiverList": { "receiver": [
{
"amount": "5.00",
"email": "vladimir.sapronov-facilitator#gmail.com",
"priamry": true
},
{
"amount": "10.00",
"email": "vladimir.sapronov-shop#gmail.com"
}]},
"actionType": "PAY",
"cancelUrl": "http://localhost",
"requestEnvelope": {"detailLevel": "ReturnAll", "errorLanguage": "en_US"}
}
I was expecting to see the invoice for $15 to vladimir.sapronov-facilitator#gmail.com which is Primary Receiver. But I see:
facilitator account's Test Store $5.00 USD
VLADIMIR SAPRONOV $10.00 USD
Total: $15.00 US
It doesn't look like "sender deals only with primary receiver". How to make it the way it's described in the documentation - want to see only transaction for $15 to Primary Receiver?

The comment from #antoniom is absolutely right. Also the amount to primary receiver should be changed to be more then amount to secondary receiver.
Here is right working example:
{
"returnUrl": "http://localhost",
"currencyCode": "USD",
"receiverList": { "receiver": [
{
"amount": 15.00,
"email": "vladimir.sapronov-facilitator#gmail.com",
"primary": true
},
{
"amount": 10.00,
"email": "vladimir.sapronov-shop#gmail.com"
}]},
"actionType": "PAY",
"cancelUrl": "http://localhost",
"requestEnvelope": {"detailLevel": "ReturnAll", "errorLanguage": "en_US"}
}

Related

PayPal APIs - Set multiple curriences in a single order

I'm trying to set more than one currency code within a single order.
I sent this json to the PayPal API Create order with two currency codes, EUR and USD, distributed at random.
{
"intent": "CAPTURE",
"brand_name": "Miller-Miller",
"cancel_url": "https://adkins-knight.biz/login/",
"landing_page": "LOGIN",
"return_url": "https://kennedy.net/",
"shipping_preference": "NO_SHIPPING",
"user_action": "PAY_NOW",
"payer_email_address": "lindaholland#gmail.com",
"payer_address_line_1": "98169 Tina Ramp Apt. 548",
"payer_address_line_2": "Unions",
"payer_admin_area_1": "United States Virgin Islands",
"payer_admin_area_2": "South Veronicaborough",
"payer_country_code": "BE",
"payer_postal_code": "16858",
"payer_full_name": "Jeremy Martin Jr.",
"payer_given_name": "Sarah",
"payer_middle_name": "Richard",
"payer_prefix": "Dr.",
"payer_suffix": "DDS",
"payer_surname": "Donovan",
"user": null,
"purchase_units": [
{
"custom_id": "3cef9acd-acfd-4b57-9426-fe25b993b51f",
"description": "Process would successful not stage girl.\nEat economy air stuff wind box city. Suffer scene deal much. Rise or friend provide.",
"invoice_id": "0f2ac8bf-c763-48a2-8207-6c15a422cf44",
"reference_id": "0ea30992-6cc2-4e3f-9f9f-bb2a1ff9458d",
"soft_descriptor": "break",
"amount_currency_code": "EUR",
"amount_value": 9998008.45,
"breakdown_discount_currency_code": "EUR",
"breakdown_discount_value": 9999889.5,
"breakdown_handling_currency_code": "USD",
"breakdown_handling_value": 9999884.8,
"breakdown_insurance_currency_code": "EUR",
"breakdown_insurance_value": 9997223.61,
"breakdown_item_total_currency_code": "USD",
"breakdown_item_total_value": 9994971.56,
"breakdown_shipping_currency_code": "USD",
"breakdown_shipping_value": 9991250.62,
"breakdown_shipping_discount_currency_code": "USD",
"breakdown_shipping_discount_value": 9997344.57,
"breakdown_tax_total_currency_code": "USD",
"breakdown_tax_total_value": 9999229.59,
"shipping_type": "SHIPPING",
"shipping_address_line_1": "2359 Greene Path Suite 645",
"shipping_address_line_2": "Springs",
"shipping_admin_area_1": "Hong Kong",
"shipping_admin_area_2": "South Debra",
"shipping_country_code": "CU",
"shipping_postal_code": "95591",
"shipping_full_name": "Ashley Stone",
"items": [
{
"category": "PHYSICAL_GOODS",
"description": "Despite should allow. Military determine up she goal.",
"name": "Mary Harper",
"quantity": 4405,
"sku": "total",
"tax_currency_code": "USD",
"tax_value": 9997113.36,
"unit_amount_currency_code": "USD",
"unit_amount_value": 9998795.33
},
{
"category": "PHYSICAL_GOODS",
"description": "Hospital cover job rest new. Only citizen I generation raise present. Majority president stuff west.",
"name": "Lucas Parker",
"quantity": 1759,
"sku": "little",
"tax_currency_code": "USD",
"tax_value": 9996456.8,
"unit_amount_currency_code": "USD",
"unit_amount_value": 9999554.88
}
]
}
]
}
I got this response:
{
"name": "UNPROCESSABLE_ENTITY",
"details": [
{
"issue": "MULTI_CURRENCY_ORDER",
"description": "Multiple differing values of currency_code are not supported. Entire Order request must have the same currency_code."
}
],
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"debug_id": "527aca32094a2",
"links": [
{
"href": "https://developer.paypal.com/docs/api/orders/v2/#error-MULTI_CURRENCY_ORDER",
"rel": "information_link",
"method": "GET"
}
]
}
I have searched through the PayPal documentation and on Google, but it is not clear if it is possible to set up two or more currencies in a single order.
The inserted curriences (EUR & USD) are both approved in my PayPal settings following these steps from PayPal FAQ:
EDIT:
If I need to set multiple products with two curriences in a single transaction, I cannot do it? Have I do separate the order in two order, apply a single currency code for each of them?
Multiple differing values of currency_code are not supported. Entire Order request must have the same currency_code.

initial_fail_amount_action not working as expected

I'm trying to create a recurring payment plan which allow me to get the user first payment immediately, for doing this I've used the option setup_fee setted as 14.99 but for some reason I can't get this working. Infact, the sandbox user that I used for this doesn't have any funds, and the subscription shouldn't be approved just as it happens. These are the payment details:
{
"name": "Monthly Plan",
"description": "Monthly plan based subscription",
"status": "ACTIVE",
"usage_type": "LICENSED",
"product_id": "PROD-32M79039A8219464Y",
"billing_cycles": [
{
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "TRIAL",
"sequence": 1,
"total_cycles": 1,
"pricing_scheme": {
"fixed_price": {
"value": "0",
"currency_code": "EUR"
}
}
},
{
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "REGULAR",
"sequence": 2,
"total_cycles": 0,
"pricing_scheme": {
"fixed_price": {
"value": "14.99",
"currency_code": "EUR"
}
}
}
],
"payment_preferences": {
"auto_bill_outstanding": true,
"setup_fee": {
"value": "14.99",
"currency_code": "EUR"
},
"setup_fee_failure_action": "CANCEL",
"payment_failure_threshold": 0
},
"taxes": {
"percentage": "0",
"inclusive": false
},
"merchant_preferences": {
"initial_fail_amount_action": "CANCEL",
"max_fail_attempts": 0
}
}
I've specified merchant_preferences, that must cancel the subscription process in the PayPal smart buttons process. But this doesn't do anything. The expected behavior:
User approve a subscription using the PayPal smart buttons
The user has no funds so PayPal should stop the process as merchant_preference configuration
If the user has found, then the subscription must be created and the funds must be sent to merchant account in order to activate the subscription in my server
What country is the sandbox user, and what funding sources are on the account? Most sandbox users have infinite funds from a default bank account funding source, or a credit card. It does not matter that their PayPal balance is zero.
In general it is not possible to create a PayPal subscription with only a PayPal balance -- a backup funding source is required.

How Can I make multiple payments in paypal?

I try to use PayPal payments API to provide parrallel payments to the multiple merchants in the single checkout. I want use this on marketplace and I want to make payments from one buyer to several sellers without intermediate account, How Can I do this?
I considered the payouts (https://developer.paypal.com/docs/payouts/integrate/api-integration/#prerequisites), but I can use this way only on my paypal account
"items": [
{
"recipient_type": "EMAIL",
"amount": {
"value": "9.87",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"sender_item_id": "201403140001",
"receiver": "receiver2#example.com"
},
{
"recipient_type": "EMAIL",
"amount": {
"value": "9.85",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"sender_item_id": "201403140001",
"receiver": "receiver#example.com"
}
I want send post like this, for one customer on my website and several seller.

PayPal hide order total

I am using PayPal's REST API to implement paying via PayPal into my website. When I send an approval request to PayPal it always shows the order total. I really don't want to show this. At the point in which we are asking for approval the user won't even know what their total order amount will be. Is there anyway to hide the order total on the PayPal page?
Are you sending line items in your API request? For example:
"item_list": {
"items": [{
"name": "Test",
"sku": "18",
"price": "7.47",
"currency": "USD",
"quantity": "1"
}
]
}
If you send the items array, the price will be displayed in PayPal's payment page.
However, you can just send a total amount, and it won't appear during buyer approval, for example:
{
"intent": "sale",
"redirect_urls": {
"return_url": "http://URL.com/restapi_test/_payments_execute-an-approved-paypal-payment.html",
"cancel_url": "http://URL.com/restapi_test/_payments_create-a-payment-paypal.html"
},
"payer": {
"payment_method": "paypal"
},
"transactions": [{
"amount": {
"total": "7.47",
"currency": "USD"
},
"description": "This is the payment transaction description."
}]
}

Paypal Batch Payout behavior on item error

With the batch payout API for Paypal, if I send a request with multiple items and there is an error with one of them, will the ones without an error still go through? Or will they all fail?
For example, if I sent a payload of:
{
"sender_batch_header": {
"sender_batch_id": "batch_8",
"email_subject": "You have a payment"
},
"items": [
{
"recipient_type": "EMAIL",
"amount": {
"value": 1.0,
"currency": "USD"
},
"receiver": "test_user#example.com",
"note": "Thank you.",
"sender_item_id": "item_1"
},
{
"recipient_type": "EMAIL",
"amount": {
"value": 1.0,
"currency": "USD"
},
"receiver": "bad_email_address",
"note": "Thank you.",
"sender_item_id": "item_1"
}]
}
Will the payout to test_user#example.com go through since the other item has an invalid email address?
Thanks
If you use
"receiver": "bad_email_address",
PayPal will throw out error as "bad_email_address" is not in email format, the whole payout can't go through, no money sent out.
If you use
"receiver": "bad_email_address#email.com",
The email address is not existed, but it's email format, the whole payment will go through, existed PayPal receiver will get the money, this un-existed email transaction will in Unclaimed status. If someone register this email address, then this person will get the money.