Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

PayPal Here is not returning back to my app #41

Open
latheesan-k opened this issue Mar 1, 2016 · 4 comments
Open

PayPal Here is not returning back to my app #41

latheesan-k opened this issue Mar 1, 2016 · 4 comments
Labels

Comments

@latheesan-k
Copy link

I am using Titanium Appcelerator to build an iOS application that lets users charge their customer using PayPal Here sideloader api.

I open the paypal here app like this:

Titanium.Platform.openURL(
    'paypalhere://takePayment?accepted=card,paypal&' +
    'returnUrl=myappurlschema://takePayment/{result}?' +
    'PaymentType={Type}&InvoiceId={InvoiceId}&TxId={TxId}&' +
    'AmountDue='+ e.amountDue +'&DiscountAmount='+ e.discountAmount +
    '&DiscountReason='+ e.discountReason +'&UsePoints='+ e.usePoints +
    '&EarnPoints='+ e.earnPoints +'&GrandTotal={GrandTotal}&as=b64&' +
    'step=choosePayment&invoice=' + 
    Titanium.Utils.base64encode(JSON.stringify(paypalInvoice)));

This correctly opens the paypal here app with my basket contents (i.e. invoice lines).

I am able to select card payment type, enter my details and charge. Once the transaction is completed, I click No Receipt, but nothing happens.

I should be taken back to my app as per specified returnUrl.

I have already verified my app's url schema is registered by opening the safari browser and visiting myappurlschema://takePayment and it opens my app, therefore paypal should have no trouble opening my app also.

I've also tried wrapping the returnUrl value with encodeURIComponent() but that did not help either.

@djMax
Copy link
Contributor

djMax commented Mar 1, 2016

If you set the returnUrl to be a web page - like www.google.com or some such, what happens? Also, what if your return URL is myappurlschema://takePayment/ without the result bit?

@latheesan-k
Copy link
Author

Hi.

Nothing happens. I've already tested this.

Sent from my iPhone

  • Latheesan

On 1 Mar 2016, at 21:23, Max Metral <[email protected]mailto:[email protected]> wrote:

If you set the returnUrl to be a web page - like www.google.comhttp://www.google.com or some such, what happens? Also, what if your return URL is myappurlschema://takePayment/ without the result bit?

Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-190911254.

@latheesan-k
Copy link
Author

After many hours of trial and error, I sort of have a semi-working version now. This is what I have so far:

// Open paypal here
var retUrl = Titanium.Network.encodeURIComponent(
    "myappurlschema://takePayment/{result}?Done"+
    "&PaymentType={Type}"+
    "&InvoiceId={InvoiceId}"+
    "&TxId={TxId}"+
    "&GrandTotal={GrandTotal}"+
    "&AmountDue="+ e.amountDue +
    "&DiscountAmount="+ e.discountAmount +
    "&DiscountReason="+ e.discountReason +
    "&UsePoints="+ e.usePoints +
    "&EarnPoints="+ e.earnPoints);
var pphereUrl = "paypalhere://takePayment?accepted=card,paypal&returnUrl="+ retUrl;
    pphereUrl += "&as=b64&step=choosePayment";
var request = pphereUrl +"&invoice="+ Titanium.Utils.base64encode(JSON.stringify(paypalInvoice));
    request = request.replace(/(\r\n|\n|\r)/gm, "");
Titanium.Platform.openURL(request);

With the above; when code executes, this is the flow:

  1. PayPal Here App opens
  2. Select "Card" payment type
  3. Enter details & click "Charge"
  4. I get a success message with option to print/text receipt etc...
  5. Clicking on "No Receipt" -> nothing happens, i see another success window
  6. If I click on "New Sale" on this window, paypal here app returns you back to my app and at this point is where I actually get the results back (i.e. PaymentType, InvoiceId, TxId etc...)

So... I am not sure what happened. Did the flow get updated or something? I distinctly remember previously, when you clicked "No Receipt" it immediately returned you back to the app with the result. Now you have to click "No Receipt" and then "New Sale" to return to app with result.

@lernerb lernerb added the ios label Mar 17, 2016
@hanji866
Copy link

Running into same problem. This work around didn't work for me. No Receipt to New Sale either does nothing or with v2 will just load the calling site, but not pass anything.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants