wsjlisseter
wsjlisseter

Reputation: 99

PayPal REST API specify web-profile PHP

TLDR: Where do I specify the web experience profile id when integrating with the PayPal REST API for the express checkout with PHP?

A question in regards to the PayPal Express Checkout integration with the REST API. I'm going to be setting up a second ecommerce site and have integrated the first with the PayPal express checkout.

Currently, it goes through adding the items and things to the transaction and sends them over to the paypal site to do their stuff processing the transaction and all that.

I've already created the profile for the checkout. But with the second site, it would need to be using a different profile. Reading online, I've see you can have parent/child accounts, which is interesting but they're saying I need over £30k/month revenue which we don't have right now as it is a niche store and still growing.

The other option from reading online is specifying the web-profile or checkout experience. This sounds perfect. Though I'm not 100% sure where to specify the name of the profile I've created for it.

This question seems to pretty much cover it Paypal Payment REST API web experience profile

Stating that I should pass: "experience_profile_id": "XP-CP6S-W9DY-96H8-MVN2" onto the JSON payload.

The thing is, where do I put this ID? Is it is the setConfig array? Or setting it for the transaction?

Any help would be appreciated.

Upvotes: 3

Views: 1478

Answers (2)

Corentin
Corentin

Reputation: 149

Must be late, but specify your experience_profile_id this way :

$payment->setIntent("sale")
    ->setPayer($payer)
    ->setExperienceProfileId('TXP-XXXXXXXXXXXXXXXXXXX')
    ->setRedirectUrls($redirectUrls)
    ->setTransactions(array($transaction));

To create an Experience profile and get the corresponding ID, you can use the sample code provided here :

https://github.com/paypal/PayPal-PHP-SDK/blob/master/sample/payment-experience/CreateWebProfile.php

Upvotes: 4

Vimalnath
Vimalnath

Reputation: 6463

You will have to include your experience_profile_id in the /v1/payments/payment request.

Example:

    curl -v POST https://api.sandbox.paypal.com/v1/payments/payment \
    -H "Content-Type:application/json" \
    -H "Authorization: Bearer <Access-Token>" \
    -d '{
        "intent": "authorize",
        "experience_profile_id": "XP-CP6S-W9DY-96H8-MVN2",
        "payer": {
            "payment_method": "paypal"
        },

...

https://developer.paypal.com/docs/integration/direct/rest-experience-overview/

Upvotes: 1

Related Questions