PRH gateway like integration
Client: Penguin Random House
Objective: To allow users to make purchases from the PRH interface using our platform as a payment gateway.
Description: The users logs into the client's interface and selects a product, upon clicking on Pay they are redirected to the Stripe or Mercado Pago of publica.la platform to complete they card details. Once the checkout is completed the user is redirected to the customer's site again.
Auth by Token integration is used to make the connection between PRH and publica.la.
The content must exist with price in the store for the integration to work.
How does it work?
- The user logs into the PRH interface with his email address.
- PRH must send us the email and the user id, which will be used for us to identify the purchase. For the token integration to work we must receive both data.
- Once the user is identified, we can create the order with the parameters received.
- After processing the order the user is redirected back to PRH.

The tenant's store must have previously loaded the publications with their respective prices, according to the country/region. In addition, the Gateway and Currency that will be used by default must be configured. In the token the path to the content is sent together with the external_id and the parameters to create the order and open the checkout:
automatically_open_checkout=default external_reference={id_issue_en_prh} return_url={url_return_on_completion_of_payment}
In addition we receive the parameter accept_terms_and_policies which accepts by default the Terms and Conditions.
The final result looks like this
PRH login with the link formed by:
http://{tenant}.publica.la/auth/token?external-auth-token={JWT-string}
Within the JWT string the following structure is found.
{
"iss": {Slug to identify who signs the token. You must use the issuer provided in the previous step},
"jti": {A unique id for the token, could be in UUID V4 format},
"exp": {Expiry date of the token, it's a timestamp expressed in seconds},
"aud": "farfalla",
"sub": "user",
"intended_url": "https://{tenant}.publica.la/library/publication/{url_issue}?automatically_open_checkout=default&external_reference={id_issue_en_prh}&return_url={url_return_url={url_return_once_finalized_payment}",
"user": {
"uuid": {user_id_issue_in_prh},
"email": {email_user_in_prh},
"accept_terms_and_policies": true
}
}