Search code examples
paypalcoldfusionlucee

i am trying to connec to paypal


I am trying to connect to the paypal but i have some questions with regards to the form data i need to pass, paypal expects it like this

"purchase_units": [
    {
      "amount": {
        "currency_code": "USD",
        "value": "100.00"
      }
    }
  ]

but the form just passes the amount > currencycode > value

so how can i convert the form scope to this type of data which paypal expects, same is the case with other data if i need to send, this is driving me nuts


Solution

  • What PayPal expects is JSON, which is one of the most common formats for sending data between systems in today's web.

    You mentioned a form scope, which must be a coldfusion thing. Are you doing a server or "client-side only" integration? Client-side only is very basic, just spit this HTML/JS out to the browser: https://developer.paypal.com/demo/checkout/#/pattern/client

    The server-based version is more involved, you will need to communicate with the PayPal API endpoints directly from your server. There are SDKs and guides for a number of more common server-side languages, which you might find adaptable to your purposes -- see 'Set Up Transaction' and 'Capture Transaction' here: https://developer.paypal.com/docs/checkout/reference/server-integration/