Simulate errors with PayPal's Smart Payment Buttons

Borisu
Contributor
Contributor

I am using Smart Payment Buttons in Sandbox. Im almost finished.

Can anyone tell me how can i simulate errors? I've turned on Negative testing. But what's next?

 

I saw that the documentation does provide 2 methods of simulating errors.

Those methods are: test values and request headers.

 

But both methods seem to be unrelated to Smart Payment Buttons because these methods use something called "Payouts API" - which i dont have.

 

I think i use Orders API.

 

Please help.

Login to Me Too
18 REPLIES 18

CamelliaSinensi
Contributor
Contributor

I could not find an answer to that. Did you find a way yet?

 

A few days ago, I activated negative testing for the sandbox account and made it worked with a a specific amount. I can't find that documentation anymore and could not reprod

Login to Me Too

Borisu
Contributor
Contributor

Hey, thanks for taking the time to respond.

 

Unfortunately, i have not found a sollution for this yet. 

Login to Me Too

not_here
Moderator
Moderator

Hi @Borisu @CamelliaSinensi,


Here is some content we have on Developer.PayPal.com, please let me know if this helps. 


Thanks,
Christina 

Login to Me Too

jlippiner
Contributor
Contributor

@not_here 

 

I think you can see from the replies that it does NOT help.


PLEASE provide us with CLEAR documentation on how to test the SMART BUTTON (not REST API, not SOAP, not NVM) for error conditions.

Login to Me Too

not_here
Moderator
Moderator

Hi @jlippiner

 

I understand the concerns, I'm working with the product teams to see how we can make this more clear. I apologize for the challenges this is presenting you. 


Christina 

Login to Me Too

mr_moneymaker
Contributor
Contributor

https://developer.paypal.com/docs/api/request-headers/ seems to suggest that we can use request headers for testing the Orders API, which is used by the Smart Button, but I don't see how we can add these headers to the request made by the button?

 

In the javascript Smart Button SDK, we give the call like this:

  paypalConfig = {
    createOrder: function(data, actions) {
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: '0.01'
          }
        }]
      });
    }
}

which I guess eventually calls https://developer.paypal.com/docs/api/orders/v2/#orders_create

How would we add the request header to the orders_create API call?

Login to Me Too

it-ico
Contributor
Contributor

You'll have to go to your Dashboard on https://developer.paypal.com/ . 

On the left side go to Sandbox --> Accounts. You'll see at least two accounts. One for your business (the seller) and one personal one (the buyer). 

Important: Go to the business account under "manage account" --> "view/edit account" and then choose the last tab on the right called "Settings". There you can enable negative testing

 

Login to Me Too

Paul_Adamson
Contributor
Contributor

I've not found a way to perform negative testing with smart buttons.  Negative testing has been enabled for my sandbox business account.  I found a page that says to use a value of 107.55 in order to simulate the 10755 error code, but createOrder() always returns completed.

 

The documentation for negative testing does not seem to be complete for smart buttons, and always refers back to using request headers, which doesn't seem to be possible with smart buttons.  Your last response about enabling negative testing does not seem to have any effect.

 

Thanks for your help,

Login to Me Too

jlippiner
Contributor
Contributor

@Paul_Adamson I completely agree.

 

This is INSANE that we cant test error conditions easily using the Smart Button.  I have an error handler and were seeing issues but no way to test it.  Turning on negative testing does nothing and there is no place for headers.

 

If you figure this out, please let me know.

 

Josh

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.