# What Payment Methods Are Supported for GPT-Image2 Credits?

> Learn about supported payment methods for GPT-Image2 credits. Discover how to purchase credits using Alipay and understand the payment flow.

- Repository: [苍何/awesome-gpt-image-2](https://github.com/freestylefly/awesome-gpt-image-2)
- Tags: getting-started
- Published: 2026-08-29

---

**GPT‑Image2 currently supports only Alipay for purchasing credits**, implementing a web‑based payment flow through a dedicated sandbox server that handles order creation, credential signing, and transaction verification.

The freestylefly/awesome‑gpt‑image‑2 repository provides a complete Alipay integration for acquiring GPT‑Image2 credits. According to the source code, no other payment gateways such as Stripe or PayPal are implemented, making Alipay the exclusive method for credit purchases.

## Alipay Web Payment Integration

The repository ships with a complete **Alipay web‑payment** implementation designed specifically for GPT‑Image2 credit transactions. The system utilizes Alipay’s sandbox environment for development and testing, ensuring secure handling of payment credentials and transaction verification.

### How the Payment Flow Works

The Alipay integration follows a standard three‑step process:

1. **Order Creation** – The backend generates a signed payment order using Alipay credentials and returns a payment URL to the client.
2. **User Payment** – The frontend redirects the user to Alipay’s payment page to complete the transaction.
3. **Verification & Crediting** – Alipay redirects back to the application, where the server verifies the transaction signature and credits the user’s account.

## Key Implementation Files

The payment functionality is concentrated in specific files within the repository:

- **`scripts/alipay‑webpay‑sandbox‑server.mjs`** – Implements the core Alipay sandbox server, including order creation (`createAlipayOrder`) and notification verification (`verifyAlipayNotification`).
- **`docs/alipay‑web‑payment.md`** – Documentation detailing the Alipay payment flow configuration and usage.
- **[`package.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/package.json)** – Lists project dependencies, including the Alipay SDK required for API interactions.
- **[`README.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/README.md)** – Provides general project overview confirming Alipay as the supported payment method.

## Starting the Alipay Sandbox Server

To begin processing payments locally, start the sandbox server using Node.js:

```bash
node scripts/alipay-webpay-sandbox-server.mjs

```

This initializes the server that listens for order creation requests and callback notifications from Alipay.

## Processing Payments

The integration exposes specific functions for handling the payment lifecycle.

### Creating Payment Orders

Generate a payment URL by calling the order creation function with user and amount parameters:

```javascript
import { createAlipayOrder } from './scripts/alipay-webpay-sandbox-server.mjs';

async function getPaymentUrl(userId, amount) {
  const order = await createAlipayOrder({ userId, amount });
  return order.paymentUrl;   // Send this URL to the frontend
}

```

This function signs the order with your Alipay credentials and returns the secure payment URL.

### Verifying Callbacks and Crediting Accounts

After the user completes payment, Alipay sends a notification to your callback endpoint. Verify this notification before crediting the account:

```javascript
import { verifyAlipayNotification } from './scripts/alipay-webpay-sandbox-server.mjs';

app.post('/api/alipay/callback', async (req, res) => {
  const isValid = await verifyAlipayNotification(req.body);
  if (isValid) {
    // Credit the user's account
    await creditUser(req.body.out_trade_no, req.body.total_amount);
    res.send('Payment successful');
  } else {
    res.status(400).send('Invalid payment');
  }
});

```

The `verifyAlipayNotification` function validates the cryptographic signature to ensure the callback originates from Alipay.

## Summary

- **Alipay is the sole supported payment method** for GPT‑Image2 credits according to the source code analysis.
- The **`scripts/alipay‑webpay‑sandbox‑server.mjs`** file contains the complete implementation for order creation and verification.
- Payments follow a three‑step flow: backend order creation, frontend payment processing, and server‑side verification before crediting.
- **No alternative gateways** (Stripe, PayPal) are present in the codebase, confirming Alipay as the exclusive option.

## Frequently Asked Questions

### Does GPT-Image2 support Stripe or PayPal for credit purchases?

No. The freestylefly/awesome‑gpt‑image‑2 codebase contains no integration files for Stripe, PayPal, or other payment processors. Only the **`scripts/alipay‑webpay‑sandbox‑server.mjs`** implementation is present, confirming Alipay as the exclusive supported method.

### Can I test payments without using real money?

Yes. The repository includes an **Alipay sandbox server** specifically designed for testing. The sandbox environment allows developers to simulate transactions and verify integration logic without processing actual financial transactions.

### Where is the payment verification logic implemented?

The verification logic resides in **`scripts/alipay‑webpay‑sandbox‑server.mjs`**. This file exports the `verifyAlipayNotification` function, which validates Alipay’s cryptographic signatures on callback notifications before authorizing credit deposits.

### What configuration file contains the Alipay SDK dependencies?

The **[`package.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/package.json)** file lists all project dependencies, including the Alipay SDK required for API authentication. The sandbox server imports and utilizes these dependencies to sign orders and verify transaction data.