When to create and delete a WebPype PayPal object (PHP)

I am using the PayPal REST API WebProfile class to configure how a PayPal site should open for a client. There are some things that are not clear to me. Based on the recommendations of PayPal, I create a WebProfile object, get a unique experience_profile_id and use it when creating the Payment object (which opens the PayPal site for payment). Snippets (lots of code, including try blocks, etc., removed for brevity):

$my_web_profile = new WebProfile(); $create_profile_response = $my_web_profile->create($my_paypal); $my_web_profile_id = $create_profile_response->getId(); $my_payment = new Payment(); $my_payment->setExperienceProfileId($my_web_profile_id); $my_payment->create($my_paypal); 

All of this works great.

My questions:

The WebProfile class enables you to update the created web profile object and delete it. When should you use update and delete methods? What time is right for creating a WebProfile object? Can it be created when the website is launched and simply reused for each customer who is trying to make a payment? Or should it be created for each payment (when the customer clicks the Buy button) and is deleted after each payment?

+5
source share
1 answer

The PayPal API Reference states:

As a merchant, you can use the Payment Experience API to create website experience profiles to customize your payment experience. You can create multiple agnostic product-oriented web experience profiles. These profiles are separated from the main payment API and your general settings and settings of the merchant profile, which allows you to use their products and types of integration.

When you create a payment, you can refer to a web experience profile that provides your customers with an unhindered shopping cart for payment flow.

This means that you just need to create a profile once for your application. A profile can be used to post multiple payments. You do not need to delete it.

0
source

Source: https://habr.com/ru/post/1238674/


All Articles