Question

We're working on an mobile app developed in Titanium Studio 3.2.0 and Titanium SDK 3.2.0.GA and Alloy 1.2.2 from Appcelerator. The app is being deployed to both Android (2.3.x and greater) and iOS(6.x or greater). To work with PayPal we're using the Titanium's PayPal module.

When we started the payment test on Android we started to get the following message: You PayPal account is restricted or locked. Go to www.paypal.com to resolve this issue:

In iOS I'm getting the message: An invalid parameter was sent: SENDER.

I don't understand why my test account was locked, I tried to create a new test account and the same thing happened. It's weird because it used to work fine in iOS and suddenly after trying to test in Android now it's not working on both.

Here's the code I use:

function createPayPalButton()
{

    Titanium.Paypal = require('ti.paypal');

    var price = paypalPrice;

    var PaypalHolderView = Ti.UI.createView({
        width: "200dp",
        height : '50dp',
        top : '10dp',
        layout : 'horizontal',
        borderRadius : '5dp',
        backgroundColor : 'transparent'
    });

    var ppArgs = {
        width: Ti.UI.FILL,
        height:"50dp",
        bottom:"20dp",
        textStyle: Titanium.Paypal.PAYPAL_TEXT_PAY, 
        appId:"APP-80W284485P519543T",
        buttonStyle: Ti.Paypal.BUTTON_194x37,
        paypalEnvironment: Ti.Paypal.PAYPAL_ENV_SANDBOX,
        feePaidByReceiver: false,
        transactionType: Ti.Paypal.PAYMENT_TYPE_DONATION,
        enableShipping: false,
        payment: {
            subtotal: price,
            tax: 0,
            shipping: 0,
            currency:"USD",
            recipient:"asama@x.com", // we're using a fake email, but we're not sure if this property should contain the email of the owner of the PayPal account.
            itemDescription:"Donation",
            merchantName:"OurMobileAppName" // not sure if we should reference to the package of our app i.e. to use com.mycompany.myapp or to just leave it as myapp
        }
    };

    var ppButton = Titanium.Paypal.createPaypalButton(ppArgs);

    PaypalHolderView.add(ppButton);

    $.MainContainer.add(PaypalHolderView);

    ppButton.addEventListener("paymentCancelled", function(e){
        Ti.API.info("Payment Canceled e: " + JSON.stringify(e));
    });

    ppButton.addEventListener("paymentSuccess", function(e){
        Ti.API.info('paymentSuccess e: ' + JSON.stringify(e));
        callback.success(e);
    });

    ppButton.addEventListener("paymentFailed", function(e){
        Ti.API.info('paymentFailed e: ' + JSON.stringify(e));
    });

    ppButton.addEventListener("paymentError", function(e){
        Ti.API.info("Payment Error e: " + JSON.stringify(e));
    });
}

Is this normal behaviour in Sandbox mode? Did I perform too many transactions? Can I unlock this test accounts?

Was it helpful?

Solution

In the end the PayPal support team didn't response back at all and we were left to find what was wrong.

What we discovered is that although our account for Production was activated to receive payments, the Sandbox account had to be activated separately, after doing that and updating our code for creating the PayPal button as follows:

var ppArgs = {
    width: Ti.UI.FILL,
    height:"50dp",
    bottom:"20dp",
    appId:"APP-80W284485P519543T",
    textStyle: Titanium.Paypal.PAYPAL_TEXT_PAY, // Causes the button's text to change from "Pay" to "Donate"
    buttonStyle: Ti.Paypal.BUTTON_194x37,
    paypalEnvironment: Ti.Paypal.PAYPAL_ENV_SANDBOX,
    feePaidByReceiver: false,
    enableShipping: false,
    payment: {
        paymentType : Titanium.Paypal.PAYMENT_TYPE_SERVICE, // we added this
        subtotal: price,
        tax: 0,
        shipping: 0,
        currency:"USD",
        recipient:"your_recipient@fake.com"
    }
};

We were able to make test purchases after this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top