I hope everyone is in good health.
I operate a website that connects various merchants, allowing them to receive payments from their customers. I want to implement a system where, if a merchant requests $100 from a customer, 1% of that amount is sent to my account. The remaining amount, after deducting the payment fee and the 1% commission, should be sent to the merchant's account.
For example:
Invoice Request: 100$
PayPal Fee: 3.98$
1% of 100$: 1$
Remaining Amount: 100 - 3.98 - 1 = 95.02$
So 1$ should sent to owner account
98.05$ should sent to merchant
Also, How can I add custom variables to this Order so I can get those values using below API request.
https://api-m.sandbox.paypal.com/v2/checkout/orders/1CH72974UG290335P/capture
& when the customer paid the requested amount then sandbox should be called.
I want to know how can I enable webhook, add 1% deduction, and can add custom variables.
Updated Order v2, After reading out comments.
curl --location 'https://api-m.sandbox.paypal.com/v2/checkout/orders' \
--header 'Content-Type: application/json' \
--header 'PayPal-Request-Id: paypal-request-id-1-sandbox' \
--header 'Authorization: Bearer A11AAJl4blmlkUnocTX2KQYUdm2gz3d94isr2tL6RvemrN49bPCmI_d5EzvhdZAqOTLl-nxIycCfdaGGvHljfnhtPR2fl_CJA' \
--header 'PayPal-Partner-Attribution-ID: TEST_SP_PPCP' \
--data-raw '{
"intent": "CAPTURE",
"purchase_units": [
{
"custom_id": "customer_paying_against_invoice_using_order_v2=1_=_company_auto_id=1_=_job_auto_id=181",
"amount": {
"currency_code": "USD",
"value": "100.00",
"breakdown": {
"item_total": {
"currency_code": "USD",
"value": "100.00"
}
}
},
"payee": {
"email_address": "sb-xyz@business.example.com",
"merchant_id": "L6HQNC247QXGQ"
},
"platform_fees": [
{
"amount": {
"currency_code": "USD",
"value": "1.00"
},
"payee": {
"email_address": "sb-abc@business.example.com",
"merchant_id": "4LZCA37NTSXH4"
}
}
],
"items": [
{
"name": "Invoice 1 - Test Job",
"description": "-",
"unit_amount": {
"currency_code": "USD",
"value": "100.00"
},
"quantity": "1"
}
]
}
],
"payment_source": {
"paypal": {
"experience_context": {
"payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
"brand_name": "Project Name",
"locale": "en-US",
"landing_page": "LOGIN",
"user_action": "PAY_NOW",
"return_url": "https://test.com/pay.php?paypal_return_url=1",
"cancel_url": "https://test.com/pay.php?cancel_url=1"
}
}
}
}'
If you are approved as a PayPal partner/platform, which is only a possibility for some, the cleanest solution is to onboard sellers with third_party_details.features.PARTNER_FEE specified.
If a seller is onboarded that way, you will be able to specify a partner_fee amount in the v2/checkout/orders API call.
If you are not approved as a PayPal partner, options are limited and there are no good ones worth going into detail about.