> For the complete documentation index, see [llms.txt](https://bify.gitbook.io/rwa-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bify.gitbook.io/rwa-docs/bify-sdk/payments.md).

# Hosted USDC Payments

BIFY Commerce uses hosted USDC transfer instructions. The partner website does not need to implement a wallet connection or a token transfer contract.

## Payment model

The checkout session contains:

| Field                          | Meaning                                                     |
| ------------------------------ | ----------------------------------------------------------- |
| `network` and `chainId`        | The Base network on which the payment must be made          |
| `payment.tokenAddress`         | The canonical USDC contract configured for the environment  |
| `payment.paymentAddress`       | The scoped BIFY payment address                             |
| `payment.totalPrice`           | The exact amount in USDC base units                         |
| `payment.paymentReferenceHash` | The payment reference used for reconciliation               |
| `externalOrderId`              | The partner's order reference shown in the checkout context |
| `expiresAt`                    | The checkout session expiry                                 |

The customer sends the exact amount, submits the transaction hash, and BIFY verifies the transaction. The payment contract and backend enforce the token, network, recipient, amount, reference, success, and replay checks.

## Inspect capabilities

Use capability discovery when the storefront needs to display the active network or feature set.

```ts
const capabilities = await bify.capabilities.retrieve();

console.log({
  network: capabilities.network,
  chainId: capabilities.chainId,
});
```

The current payment method is `usdc` and the current payment mode is `hosted_transfer`. Card and fiat payment methods are not part of this integration surface. Use the public widget configuration endpoint when a custom UI needs the deployed Commerce contract addresses.

```ts
const widgetConfig = await fetch("https://api.bify.io/v1/widget/config")
  .then((response) => response.json());

const certificateController = widgetConfig.contracts.productCertificateController;
```

## Confirm a payment manually

The hosted widget normally performs this public call. A custom customer UI can call the same SDK method instead.

```ts
const confirmation = await bify.checkout.confirmHosted({
  sessionId,
  clientToken,
  transactionHash: "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
});

if (confirmation.session.status === "settled") {
  // Display a receipt state. Fulfilment still follows server-side settlement
  // reconciliation and the partner's own order rules.
}
```

Never accept a transaction hash from the browser as proof of payment without the BIFY confirmation response or signed settlement event.

## Retrieve order status

```ts
const order = await bify.orders.retrieve({
  externalOrderId: partnerOrderId,
});

switch (order.status) {
  case "settled":
  case "fulfilled":
  case "certificate_pending":
  case "certificate_ready":
  case "certificate_minted":
    await releaseFulfilmentIfYourOrderIsNotAlreadyReleased(order);
    break;
  default:
    await keepOrderInPaymentPendingState(order);
}
```

Prefer webhooks for normal state changes. Use retrieval for reconciliation, support tooling, and recovery after an unavailable webhook endpoint.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://bify.gitbook.io/rwa-docs/bify-sdk/payments.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
