# Re-charge Card

### Enable Card Re-Charge&#x20;

Hey there! Please contact the Startbutton team if you would like to access this feature. With a single API, you can initiate a card re-charge on domestic and international cards.

### Complete First Charge&#x20;

In order for us to ensure that the card is valid and can be charged for subsequent transactions, initializing a first charge is required. You could do this as described [here](/startbutton-product-api/startbutton-api-doc/accept-payments.md) for your customer's first transaction with the card.

{% hint style="info" %}
The minimum amount we recommend for the first charge is NGN 50.00, GHS 0.10. Lower amounts are not guaranteed to work on all card brands or banks.&#x20;
{% endhint %}

### Store Card Authorization Code

Once the first transaction is successful (via the initialize transaction endpoint), you should have the webhook payload by [listening for webhook notifications or getting the transaction status](/startbutton-product-api/startbutton-api-doc/webhook.md).

Store the `authorizationCode` returned to you via the webhook payload or the '`get transaction status`' endpoint. This can be used to charge the card subsequently. Avoid saving an `authorizationCode` multiple times.

{% tabs %}
{% tab title="Sample webhook payload (Recharge enabled)" %}

```
{
  event: "collection.completed",
  data: {
    merchantId: "64459778bf350cc65485986c",
    paymentPartner: {
      id: "644a50bb188729db2115443b"
      name: "Paystack",
      currency: "NGN",
    },
    transaction: {
      _id: "648ca8aba0fa641316284dc3",
      transType: "collection",
      status: "processing",
      toAmount: 200000,
      toCurrency: "NGN",
      merchantId: "64459778bf350cc65485986c",
      transactionReference: "69f146f0487b",
      customerEmail: "test@customer.com",
      paymentCode:
        "d316a59258c21bd06d23288ce8cedc679686bef8a9907e89bc6e630fb2a1e32f639d4bee4deeb8aaf3e8dada44867a0650e32d60feae47f2a99099f96d176d1b00434876b29e8a03a728312bec3cfc429b7ac26fc73021ab13551e104e2f2680",
      isRecurrent: "false"
      createdAt: "2023-06-16T18:23:39.716Z",
      updatedAt: "2023-06-16T18:23:41.837Z",
      __v: 0
      },
      authorizationCode: "f2e4a43dc7bxxx"
    },
  },
```

{% endtab %}

{% tab title="Sample webhook payload (Recharge disabled)" %}

```
{
  event: "collection.completed",
  data: {
    merchantId: "64459778bf350cc65485986c",
    paymentPartner: {
      name: "Paystack",
      currency: "NGN",
    },
    transaction: {
      _id: "648ca8aba0fa641316284dc3",
      transType: "collection",
      status: "processing",
      toAmount: 2000,
      toCurrency: "NGN",
      merchantId: "64459778bf350cc65485986c",
      transactionReference: "69f146f0487b",
      customerEmail: "test@customer.com",
      paymentPartnerId: {
        name: "Paystack",
        currency: "NGN",
      },
      paymentCode:
        "d316a59258c21bd06d23288ce8cedc679686bef8a9907e89bc6e630fb2a1e32f639d4bee4deeb8aaf3e8dada44867a0650e32d60feae47f2a99099f96d176d1b00434876b29e8a03a728312bec3cfc429b7ac26fc73021ab13551e104e2f2680",
      createdAt: "2023-06-16T18:23:39.716Z",
      updatedAt: "2023-06-16T18:23:41.837Z",
    },
  },
};
```

{% endtab %}
{% endtabs %}

### Post Re-Charge Request

For subsequent card charges, send the `authorizationCode` and `amount` in the param.

| Authorization | Set value to SECRET\_KEY        |
| ------------- | ------------------------------- |
| Content-type  | Set value to `application/json` |

{% hint style="info" %}
The secret key can be gotten from the 'Settings' page on your Startbutton dashboard.&#x20;
{% endhint %}

Post a request to the URL below, where the base URL is determined by the environment you are on.

<details>

<summary>BaseUrl</summary>

PROD : <https://api.startbutton.tech&#x20>;

</details>

{% tabs %}
{% tab title="Endpoint" %}
POST  `{{baseurl}}/transaction/recurrent`
{% endtab %}
{% endtabs %}

**Sample request:**

```postman_json
{
    "authorizationCode": "f2e4a43dc7b313",
    "amount": 27000,
    "reference": "43ntjb4tph"
}
```

**Sample response:**

```json
{
    "success": true,
    "message": "transaction",
    "data": "processing"
}
```

### Webhooks

Go [here](#webhooks) to understand webhooks and getting transaction status

{% hint style="info" %} <mark style="color:blue;">`isRecurrent`</mark> is <mark style="color:blue;">`true`</mark> in the webhook when the card is charged via the Recharge endpoint.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://startbutton.gitbook.io/startbutton-product-api/startbutton-api-doc/re-charge-card.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
