# Stripe Payment Links

> Check a subscription Payment Link's params, add the consent checkbox and renewal terms, and update existing links.

Payment Links render the same Stripe-hosted page as Checkout, so they need the same two additions: a required consent
checkbox labelled with the renewal terms, and the renewal disclosure next to the Subscribe button.

## Preflight a link {#preflight}

Send the `paymentLinks.create` params — or a link you retrieved from Stripe, including its id. When `line_items` use a
Price id, add the price and interval in `merchant`:

```curl
curl https://app.checkbox.site/v1/checks/stripe_payment_link \
  -u "$CHECKBOX_SECRET_KEY:" \
  -H "Content-Type: application/json" \
  -d '{
    "params": { "line_items": [{ "price": "price_1Q2w3E", "quantity": 1 }] },
    "merchant": {
      "merchant_name": "Joybox",
      "price": 19.99,
      "interval": "month",
      "cancel_url": "https://joybox.example/account/cancel"
    }
  }'
```
```node
import Checkbox from '@checkbox-site/cli';

const checkbox = new Checkbox(process.env.CHECKBOX_SECRET_KEY);

const result = await checkbox.checks.stripePaymentLink({
  params: { line_items: [{ price: 'price_1Q2w3E', quantity: 1 }] },
  merchant: { merchant_name: 'Joybox', price: 19.99, interval: 'month', cancel_url: 'https://joybox.example/account/cancel' },
});
console.log(result.verdict);
console.log(result.correction.corrected_params.custom_text);
```
```python
import os
from checkbox import Checkbox

checkbox = Checkbox(os.environ["CHECKBOX_SECRET_KEY"])

result = checkbox.checks.stripe_payment_link(
    params={"line_items": [{"price": "price_1Q2w3E", "quantity": 1}]},
    merchant={"merchant_name": "Joybox", "price": 19.99, "interval": "month",
              "cancel_url": "https://joybox.example/account/cancel"},
)
print(result["verdict"])
print(result["correction"]["corrected_params"]["custom_text"])
```

Apply `correction.patch` to the params you create the link with. `consent_collection.terms_of_service: "required"` needs a
Terms of Service URL in Stripe (Dashboard → Settings → Public details).

## Existing links {#existing-links}

Stripe lets you update a link's `custom_text` in place, but not add `consent_collection` to a link that exists: for
that you create a replacement link and point your buttons at it. In the dashboard (**Site → Fixes**), Checkbox can do
either for you with a Payment Links write key you grant only for this: it shows a dry run first, then applies the
change and records it as evidence.

As with Checkout, *clear and conspicuous* stays `needs_review` on the Stripe-hosted page; show the disclosure, set off,
on your own page next to the link. See [Stripe Checkout](https://checkbox.site/docs/guides/stripe-checkout#before-redirect).
