BenGraham

FileMaker Go solution connect with PayPalHere app - how to structure returnURL with script parameter(s)

Discussion created by BenGraham on Jul 31, 2014
Latest reply on Aug 4, 2014 by user19752

I am working on integrating my FM solution to accept mobile payments with the PayPalHere app for iOS.  I can get my invoices to post fine and process in the app and can return to FMGo and even call a script, just no parameters are coming across.  My trouble seems to be with structuring the returnURL so that the output fields from PayPalHere are properly posted as parameter or parameters to the FM script.

 

PayPalHere API reference: https://github.com/paypal/here-sideloader-api-samples/tree/master/docs

 

Recommended example:

 

 

What I have that is correctly posting the invoice to PayPalHere and returns to my FMG solution and calls the script: PostPayPalPayment. This script for the moment just brings up a custom dialog to display the specified $param script parameter and Get ( ScriptParameter ) just incase.  Both values are coming up empty when the script runs.

 

"paypalhere://takePayment?

accepted=cash,card,paypal

&returnUrl=FMP://~/FlatRateGo.fmp12?script=PostPayPalPayment&$param=//takePayment/{result}?Type={Type}&InvoiceId={InvoiceId}&Tip={Tip}&Email={Email}&TxId={TxId}

&as=b64

&step=choosePayment

&payerPhone=" & inv_CLIENT::Phone

& "&invoice=" // append JSON Invoice object here

 

Since it is able to call the script I think the problem is after '$param=' that either the PayPal here app will has trouble seeing the '/takePayment/{result} due to the longer url preceeding it or it is a character needed between these, or maybe an encoding issue?  I have tried using the ":" after the '=' and using a single '/' instead of '//' before 'takePayment/{result}?...'

 

The API says returnURL is: Root URL of your app, including the call that was invoked by your app.

Example: my_registered_location://takePayment

 

An example of the full URL before encoding is:

paypalhere://takePayment?
accepted=cash,card,paypal
&returnUrl=my_registered_location://takePayment/{result}?Type={Type}&InvoiceId={InvoiceId}&Tip={Tip}&Email={Email}&TxId={TxId}
&as=b64
&step=choosePayment
&payerPhone=4155551212
&invoice=
{
    "paymentTerms": "DueOnReceipt",
    "discountPercent": "0",
    "currencyCode": "USD",
    "number": "1457",
    "merchantEmail": "merchant@ebay.com",
    "payerEmail": "foo@bar.com",
    "itemList": {
        "item": [
            {
                "taxRate": "8.5000",
                "name": "Curtains",
                "description": "Blue curtains",
                "unitPrice": "29.99",
                "taxName": "Tax",
                "quantity": "1"
            },
            {
                "taxRate": "0",
                "name": "Delivery Fee",
                "description": "Delivery Fee",
                "unitPrice": "5.0",
                "taxName": "Tax",
                "quantity": "1"
            }
        ]
    }
}

 

 

Anyone with experience working with communication between FMG and other apps in iOS that can point me in the right direction. 

 

Thank you for any help.

Outcomes