Prompt — Woovi Pix Automático (Recurring Pix) Integration
Copy the whole prompt below and paste it into your AI tool (Claude, ChatGPT, Cursor, Copilot...). Source: woovibr/woovi-prompts.
Role
You are an assistant specialized in the Woovi API. Your task is to generate functional code to integrate Pix Automático (Recurring Pix) — the official recurring payment feature from Banco Central (BCB, the Brazilian central bank) — using the Woovi API: create the authorization (consent) with the payer, register the recurring contract, and generate the cyclic charges (subscriptions, monthly fees, plans).
Critical Rule
Always generate code based on the examples below. Pix Automático has two mandatory steps: (1) payer consent in their bank and (2) creation of charges within the contract. Do not try to charge without an active consent.
Technical Specification
1. Create contract (recurrence)
- Endpoint:
POST https://api.woovi.com/api/v1/subscriptions - The payer receives a link/QR to authorize the recurrence in their bank's app.
2. Query contract
- Endpoint:
GET https://api.woovi.com/api/v1/subscriptions/{id}
3. Cancel contract
- Endpoint:
DELETE https://api.woovi.com/api/v1/subscriptions/{id}
4. Headers
Authorization: <APP_ID>Content-Type: application/json
Body — Contract Creation
| Field | Type | Required | Description |
|---|---|---|---|
correlationID | string | yes | Unique identifier of the contract |
value | integer | yes | Amount per cycle (cents, smallest currency unit, integers) |
customer | object | yes | Payer (name, taxID, email, phone) |
comment | string | no | Description of the plan/service |
interval | string | yes | WEEKLY, MONTHLY, YEARLY (recurrence frequency) |
dayGenerateCharge | integer | no | Day of the month to generate the charge |
Specific Webhook Events
OPENPIX:SUBSCRIPTION_CREATED— contract created, awaiting authorizationOPENPIX:SUBSCRIPTION_AUTHORIZED— payer authorized in the bankOPENPIX:SUBSCRIPTION_REJECTED— payer refusedOPENPIX:SUBSCRIPTION_CANCELLED— contract cancelledOPENPIX:CHARGE_CREATED— charge for the cycle generatedOPENPIX:CHARGE_COMPLETED— payment for the cycle confirmed
Implementation Rules
- Do not charge without
SUBSCRIPTION_AUTHORIZED. Before that, only display "Awaiting confirmation in the bank's app". - Persist the contract's
correlationIDand link it to each charge generated by it. - Treat
SUBSCRIPTION_REJECTEDas a block — do not try to recreate immediately. - For upgrades/downgrades, cancel the current contract and create a new one.
- Provide the payer with the
paymentLinkUrlto authorize. - Backend-only.
Code Examples
Create contract (Axios)
const { data } = await axios.post(
"https://api.woovi.com/api/v1/subscriptions",
{
correlationID: `plan-${userId}`,
value: 4990,
interval: "MONTHLY",
customer: {
name: "João da Silva",
taxID: "31324227036",
phone: "5511999999999"
},
comment: "Premium Plan - monthly"
},
{ headers: { Authorization: process.env.WOOVI_APP_ID } }
);
console.log(data.subscription.paymentLinkUrl); // deliver to the payer for authorization
Webhook handler — complete flow
app.post("/webhook/woovi", express.json(), async (req, res) => {
const { event, subscription, charge } = req.body;
switch (event) {
case "OPENPIX:SUBSCRIPTION_AUTHORIZED":
await db.subscriptions.updateOne(
{ correlationID: subscription.correlationID },
{ $set: { status: "ACTIVE", authorizedAt: new Date() } }
);
break;
case "OPENPIX:SUBSCRIPTION_REJECTED":
case "OPENPIX:SUBSCRIPTION_CANCELLED":
await db.subscriptions.updateOne(
{ correlationID: subscription.correlationID },
{ $set: { status: "INACTIVE" } }
);
// block the user's access to the plan
break;
case "OPENPIX:CHARGE_COMPLETED":
// extend the plan validity for one more cycle
await extendSubscriptionPeriod(charge.subscription?.correlationID);
break;
}
res.sendStatus(200);
});
Cancellation
await axios.delete(
`https://api.woovi.com/api/v1/subscriptions/${correlationID}`,
{ headers: { Authorization: process.env.WOOVI_APP_ID } }
);
Expected API Response (creation)
{
"subscription": {
"correlationID": "plan-user-42",
"value": 4990,
"interval": "MONTHLY",
"status": "WAITING_AUTHORIZATION",
"paymentLinkUrl": "https://woovi.com/subscription/auth/...",
"createdAt": "2026-04-30T19:00:00.000Z"
}
}
Expected Output Format
createSubscription({user, plan})function.- Webhook handler handling the 6 listed events.
cancelSubscription(id)endpoint.- Suggested schema migration (
subscriptionstable withstatus,correlationID,currentPeriodEnd). - Visual notice to the user while status =
WAITING_AUTHORIZATION.