Flawless transfer on PayPal classic does nothing - paypal

Everyhing works flawlessly with my PayPal classic implementation in the sandbox. (Marked as deprecated from jan 17 but still supported.) But it simply does not transfer money from the customer to the merchant.
"payment": {
"intent": "sale",
"transactions": [
{
"amount": {
"total": "1.21",
"currency": "EUR",
"details": {
"subtotal": "1.08",
"tax": "0.02",
"handling_fee": "0.11"
}
},
"description": "Description content."
}
]
}
After the customer agrees and executes the payment I receive an authorization:
"onAuthorize": {
"paymentToken": "EC-024873345P059811F",
"orderID": "EC-024873345P059811F",
"payerID": "4M6QNG7UDS626",
"paymentID": "PAY-7W7465253T270972NLO5EG6A",
"intent": "sale",
"returnUrl": "https://www.sandbox.paypal.com/?paymentId=PAY-7W7465253T270972NLO5EG6A&token=EC-024873345P059811F&PayerID=4M6QNG7UDS626"
}
I expect that the money transfer took place but nothing shows. No transactions, no errors, no nothing. As if nothing happened. I also expect that I get a notification if the transaction is not executed due to its deprecation. That is not the case. I am clueless.

I wasn't using the deprecated classic after all but the new Client Side Rest: https://developer.paypal.com/demo/checkout/#/pattern/client
It is close to classic, I only needed to add ...
return actions.payment.execute();
Then the actual transfer takes place. I am a happy coder now.

Related

Paypal subscription with no shipping address

I'm developing a digital subscription model using Paypal's rest API. I'm following https://developer.paypal.com/docs/subscriptions/ as well as referencing the API doc for more details.
I'm having difficulty figuring out how to omit the shipping address requirement entirely. When the customer is on paypal's subscription approval page (on paypal.com), shipping address selection is always shown. I've already tried not entering shipping_address as well as omitting the tax charge_model. Neither of these change anything on the approval page. Companies like Netflix, Hulu, and all other sites I've checked don't require a shipping address when the customer is on the approval page. Any ideas?
Within the subscription payload, just set the shipping option to NO_SHIPPING like so:
"shipping_preference": "NO_SHIPPING"
Here's an example of a complete payload:
subscriptionBodyPayload = {
"plan_id": `${subscriptionId}`,
"start_time": `${startDate}`,
"subscriber": {
"name": {
"given_name": `${first_name}`,
},
"email_address": `${userEmail}`
},
"application_context": {
"brand_name": "SerpWorx",
"locale": "en-US",
"shipping_preference": "NO_SHIPPING",
"user_action": "SUBSCRIBE_NOW",
"payment_method": {
"payer_selected": "PAYPAL",
"payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED"
},
"return_url": "https://example.com/success/",
"cancel_url": "https://example.com/checkout/"
}

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.

Paypal REST AVS/CV2 codes

I'm using PayPal REST API via rest-api-sdk-java and would like to ask whether it is possible to get AVS/CVV match results in the response (or error object).
I did couple of tests (with sandbox and negative testing turned on) according to https://developer.paypal.com/docs/classic/lifecycle/sb_error-conditions/ (parts "Testing AVS errors" and "Testing CVV code"):
Payment request with billing address street "123 AVS_A Street" results in INTERNAL_SERVICE_ERROR:
{
"name": "INTERNAL_SERVICE_ERROR",
"debug_id": "baf56174e98c8",
"message": "An internal service error has occurred",
"information_link": "https://developer.paypal.com/webapps/developer/docs/api/#INTERNAL_SERVICE_ERROR"
}
The same payment request with billing address street "123 AVS_M Street" results in successful sale.
Is INTERNAL_SERVICE_ERROR expected error in such scenario (AVS_A) ? Is there any way how to get "raw AVS code" instead of INTERNAL_SERVICE_ERROR or CREDIT_CARD_REJECTED?
My request payload:
{
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card": {
"number": "4446283280247004",
"type": "visa",
"expire_month": 11,
"expire_year": 2018,
"cvv2": "888",
"first_name": "Susan",
"last_name": "Wagner",
"billing_address": {
"line1": "123 AVS_A Street",
"line2": "Billing Address Line 2",
"city": "London",
"country_code": "GB",
"postal_code": "W1T 2BU",
"state": "",
"phone": "12345"
}
}
}
]
},
"transactions": [
{
"amount": {
"currency": "GBP",
"total": "3.55",
"details": {
"shipping": "0.00",
"subtotal": "3.55",
"tax": "0.00"
}
},
"description": "T-Shirt XYZ"
}
]
}
And one more question: Is it possible to use advanced Fraud Management Filters on Sandbox environment? I'm using Pro test account but still can't use the filters (nothing happens when I click "upgrade now" button):
https://www.sandbox.paypal.com/uk/cgi-bin/webscr?cmd=_rc-manage
looking at the debug id, the test did work - sort of -
Internal Sandbox API Error is 10555 - Filter Decline
--> https://developer.paypal.com/webapps/developer/docs/classic/api/errorcodes/
The transaction was declined because of a merchant risk filter for AVS. Specifically, the merchant has set the filter to decline transactions when the AVS returns a partial match.
So you've likely enabled the AVS fraud management filter on the sandbox account.
Obviously, there should be a proper error message and not just an internal service error, but it looks like the error hasn't been mapped yet.
Will follow up with the PP Devs to report & fix it ;)
As for AVS / CVV response within REST - there doesn't seem to be a way to retrieve the AVS/CVV response of the issuing bank just yet.

PayPal REST API: how to do an immediate payment and without asking for shipping address

I'm trying to use PayPal REST API instead of PayPal Classic API but it seems that the REST API is lacking two features that the Classic API has:
immediate payment: when the user goes to PayPal page show him a "Pay now" button instead of a "Continue" button and "You’re almost done. You will confirm your payment on ..." phrase.
no shipping address: avoid asking the user to confirm his shipping address while on PayPal page (in Classic API is done with NOSHIPPING=1 parameter, if I remember well)
So my question is: is it possibile do perform an immediate payment without asking for shipping address using REST API? Do I have to go back to Classic API?
I provide here a little more informations about how I'm using the PayPal REST API.
I'm using the PayPal REST Java SDK.
This is a sample request:
{
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"transactions": [
{
"amount": {
"currency": "USD",
"total": "5",
"details": {
"subtotal": "5"
}
},
"description": "This is the payment transaction description.",
"item_list": {
"items": [
{
"quantity": "1",
"name": "Item 1",
"price": "5",
"currency": "USD"
}
]
}
}
],
"redirect_urls": {
"return_url": "http://XXX/handlePayment.jsp?guid\u003dXXX",
"cancel_url": "http://XXX/cancelPayment.jsp?guid\u003dXXX"
}
}
And its response:
{
"id": "XXX",
"create_time": "2014-06-29T08:52:55Z",
"update_time": "2014-06-29T08:52:55Z",
"state": "created",
"intent": "sale",
"payer": {
"payment_method": "paypal",
"payer_info": {
"shipping_address": {}
}
},
"transactions": [
{
"amount": {
"total": "5.00",
"currency": "USD",
"details": {
"subtotal": "5.00"
}
},
"description": "This is the payment transaction description.",
"item_list": {
"items": [
{
"name": "Item 1",
"price": "5.00",
"currency": "USD",
"quantity": "1"
}
]
}
}
],
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/XXX",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=XXX",
"rel": "approval_url",
"method": "REDIRECT"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/XXX/execute",
"rel": "execute",
"method": "POST"
}
]
}
While delving through the REST API I came across this
I believe this means you don't have to go about creating any "Profiles" as such, and can just pass them along with the payment call...
Further explanation as requested :)
Below is an example of passing PayPal experience parameters along with a particular payment call using the Client-side JS method for Express checkout.
payment: function(data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '1.00', currency: 'USD' }
}
]
},
experience: {
input_fields: {
no_shipping: 1
}
}
});
},
Hope that makes enough sense to you guys! :)
Unfortunately, the REST API is still a long ways behind the Classic API with features it provides. These features you mentioned are things I've seen come up quite a bit, and to my knowledge they are not yet available with the REST services.
I personally have stuck with Classic as they provide everything and I really see no advantage to using REST myself. If you happen to be working with PHP (which I always do) you may be interested in my class library for PayPal. It makes all of the Classic API calls very quick and easy for you, and it's available on Packagist so you can use with Composer easily.
The REST API now supports no-shipping with the Payment Experience APIs.
You need to create a web experience profile and supply no_shipping as an input field. Then use the profile ID when creating the payment.
The profile ID doesn't need to be recreated every time.
appreciate that this post hasn't had any activity for a while but...
i hit on the exact same problem and used this post as a start point for my own question:
paypal api: take immediate payment without a shipping address
it's taken a bit of trial and error but i you can create a one off web profile with 'no_shipping' set to 1, store the id that it creates and then pass that in with future payments that don't require a shipping address.
still haven't figured out how to get rid of the 'You're almost done. You will confirm your payment on xxx.' but my payment process is a far better place than it was!
hope this helps someone out there as this no shipping issue is one that a lot of people appear to be hitting with the paypal api...
I tried using the experience section of the API and apart from still not being able to force a locale code have been able to disable shipping and go straight to billing:
payment: {
transactions: [{
invoice_number: document.getElementById("ReqTxt").value,
amount: {
total: document.getElementById("InvoiceAmt").innerText,
currency: document.getElementById("Currency").innerText
}
}]
},
experience: {
input_fields: {
no_shipping: 1
},
flow_config: {
landing_page_type:'billing'
}
}
you can also see this page. It is possible to set the user action in the flow_config section too
For 'Pay Now' instead of 'Continue' on Paypal I use a special param in approval url:
$approvalUrl = $payment->getApprovalLink().'&useraction=commit';
Result:
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=TOKEN&useraction=commit