Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paypal Payment REST API web experience profile

Tags:

rest

api

paypal

I am using the paypals rest API and integrating paypal with payments.

I manage to create the web experience profile with the following code, but i cant run this code 2 times, it says the profile already exists.

does this mean that i have to create one profile and use it for all customers and all transactions ?

for how long a web experience profile is is valid for.

or do i have to change the profile name and create a new profile for each transaction ?

curl -v POST https://api.sandbox.paypal.com/v1/payment-experience/web-profiles \
  -H 'Content-Type:application/json' \
  -H 'Authorization: Bearer <Access-Token>' \
  -d '{
    "name": "YeowZa! T-Shirt Shop",
    "presentation": {
    "brand_name": "YeowZa! Paypal",
    "logo_image": "site",
    "locale_code": "US"
  },
    "input_fields": {
    "allow_note": true,
    "no_shipping": 0,
    "address_override": 1
  },
    "flow_config": {
    "landing_page_type": "billing",
    "bank_txn_pending_url": "site"
  }
}'
like image 318
CyberKANI Avatar asked Dec 10 '22 20:12

CyberKANI


2 Answers

In addition to the previous answer -

  • You first Create a profile with a name
  • After it's created, if you want to use the profile, use it's id (assigned to it by Paypal)

Depending on how you want to implement this, you flow could possibly be to

  1. Obtain existing profiles (if any)

  2. Then evaluate whether you want to add or obtain the id

    • if name (or id) exists, obtain/use its id, otherwise,
    • if you add (Create), the response will return the id

Hth...

like image 143
EdSF Avatar answered Dec 24 '22 20:12

EdSF


  • There's no "lifecycle time" defined for a web experience profile, not until you update it or delete the profile
    DELETE /v1/payment-experience/web-profiles/<Profile-Id>

  • Pass the profile ID into the JSON payload for each payment request,

    "experience_profile_id": "XP-CP6S-W9DY-96H8-MVN2"
    

    reuse the profile unless you need different experience settings (allow shipping / note / logo img, etc).

Check this out for more details on Payment Experience overview

like image 21
pp_pduan Avatar answered Dec 24 '22 21:12

pp_pduan