Retrieve a Setup Intent
Retrieve a Setup Intent resource by ID.
A Setup Intent can be retrieved from the client side using a public API key when the client_secret is passed via query string. Getting the setup intent from the client side is normally done through our client-side library called PayRexJS.
If you will retrieve the setup intent from our backend, you can use the secret API key without passing the client secret.
Fetching the Setup Intent using the secret API key from the backend returns more sensitive information than retrieving it from the client side. The attributes returned from the client side via the public API contain the information needed to complete a payment.
Endpoint
GET /setup_intents/:id
Sample code
- curl
- Node
- PHP
- Python
- Ruby
curl --location 'https://api.payrexhq.com/setup_intents/<ID of a setup intent resource>' \
-u replace_with_secret_api_key:
const client = require('payrex-node')('insert your PayRex Secret API key.');
const setupIntent = await client.setupIntents.retrieve('<ID of a setup intent resource>');
$client = new \Payrex\PayrexClient('insert your PayRex Secret API key.');
$setupIntent = $client->setupIntents->retrieve('<ID of a setup intent resource>');
from payrex import Client as PayrexClient
client = PayrexClient('insert your PayRex Secret API key.')
setup_intent = client.setup_intents.retrieve('<ID of a setup intent resource>')
client = Payrex::Client.new("insert your PayRex Secret API key.")
setup_intent = client.setup_intents.retrieve("<ID of a setup intent resource>")
Parameters
client_secret REQUIRED IF YOU USE A PUBLIC KEY.
The client secret of the Setup Intent. This attribute is required if you authenticate with the endpoint using your public key. This endpoint is used by PayRexJS using the public key.
Returns
Returns a Setup Intent resource.