AcrossFlow Start free

New mini program: redeem jump tokens and report migrations

The two endpoints the new mini program's backend calls: redeem the member's af_token for their balances in the old mini program, then report the migration once the member is credited.

MethodURLCalled byAuthentication
POSThttps://open.acrossflow.com/v1/mp/redeemNew mini program's backendRedeem token
POSThttps://open.acrossflow.com/v1/mp/migratedNew mini program's backendRedeem token

A member who jumps from the old mini program to the new one carries a single-use jump token (af_token). The new mini program's backend redeems it for the member's points and stored value from the old mini program, credits the member, then reports the migration. For members who open the new mini program directly, without a jump, see Look up members by mobile or email. For authentication, response structure, and common error codes, see the API overview.

Call sequence

Old mini programNew mini programNew backendAcrossFlow
  1. wx.navigateToMiniProgram with af_token
  2. af_token and the member's session
  3. /v1/mp/redeem
  4. Points and stored value
  5. /v1/mp/migrated after crediting
The Redeem token stays on the new mini program's backend, never in mini program code.
  1. The old mini program opens the new one with wx.navigateToMiniProgram, passing af_token both in the landing path's query string and in extraData.
  2. The new mini program reads af_token from its launch options and sends it to its own backend together with the member's session.
  3. The backend calls /v1/mp/redeem to retrieve the member's points and stored value.
  4. After crediting the member, the backend calls /v1/mp/migrated to report the migration.
Server side only

A Redeem token can read the balance of any member in its channel. Deploy it only on the new mini program's server; never include it in mini program code.

Redeem a jump token

POST https://open.acrossflow.com/v1/mp/redeem
Authorization: Bearer aft_…
Content-Type: application/json

{ "token": "<af_token>" }

Request parameters

FieldTypeRequiredDescription
tokenstringYesThe af_token the member arrived with, unmodified

Response

{
  "ok": true,
  "jumpTokenId": "jmp_…",
  "channelId": "chn_…",
  "openId": "<the member's OpenID in the old mini program>",
  "member": {
    "memberId": "mem_…",
    "name": "…",
    "points": 12050,
    "balance": 3000,
    "mobile": "+85291234567",
    "email": null,
    "extra": { "coupons": "2 × $20 off $100" },
    "status": "redeemed",
    "migratedAt": null,
    "migratedOpenId": null
  }
}
FieldTypeDescription
jumpTokenIdstringID of this jump. Required by the report endpoint; persist it
channelIdstringThe channel that issued the jump token
openIdstringThe member's OpenID in the old mini program
memberobject | nullThe member record the merchant imported; null if this member was never imported
member.memberIdstringAcrossFlow member ID
member.namestringMember name as imported
member.pointsintegerPoints, multiplied by 100
member.balanceintegerStored value, multiplied by 100, in the currency the merchant imported
member.mobilestring | nullThe member's mobile number in E.164 format; null if none
member.emailstring | nullThe member's email address, lowercase; null if none
member.extraobjectExtra columns the merchant added to the member sheet, such as coupons or tiers. Keys are the headers as written; values are the cell text, an empty string where blank. An empty object if there are none. How to credit them is up to the caller
member.statusstringMigration status: pending (not redeemed), redeemed (redeemed, not yet reported), or migrated (migration reported). The redeem endpoint returns the status after this redemption
member.migratedAtstring | nullWhen the migration was first reported; null if not reported
member.migratedOpenIdstring | nullThe new mini program OpenID passed in the migration report; null if not reported

Notes

  • A jump token is valid for 600 seconds from issue and can be redeemed once. If redemption fails, have the member return to the old mini program and jump again.
  • A Redeem token can only redeem jump tokens issued by its own channel. A token from another channel returns 401 token and is not consumed.
  • Credit each member only once; this is the caller's responsibility. The same member can redeem more than once, for example by jumping again after a failed report, and redeeming an already migrated member still returns the full original balance. Before crediting, check member.memberId against your own records and never credit the same member twice.
  • status, migratedAt, and migratedOpenId come from migration reports and are for reference only. If crediting succeeded but the report failed, they still show the member as not migrated. Your own records decide whether a member has been credited.
  • mobile and email come from the member sheet the merchant imported, and may be filled in by a report; see Report a migration.
  • This endpoint is not idempotent: retrying after a lost response returns 401 token. See Retries and idempotency.

Report a migration

Call after the member has been credited, with the same Redeem token. Report a member who redeemed a jump with its jumpTokenId. A member found through the lookup endpoint has no jumpTokenId; report it with its memberId.

POST https://open.acrossflow.com/v1/mp/migrated
Authorization: Bearer aft_…
Content-Type: application/json

{
  "jumpTokenId": "jmp_…",
  "openId": "<the member's OpenID in the new mini program>",
  "mobile": "+85291234567",
  "email": "member@example.com"
}

Request parameters

FieldTypeRequiredDescription
jumpTokenIdstringOne ofThe jumpTokenId returned by the redeem endpoint
memberIdstringOne ofThe memberId returned by the lookup endpoint. Must not be sent together with jumpTokenId
openIdstringYesThe member's OpenID in the new mini program
mobilestringNoMobile number; see Data types for the format. Ignored when reporting by memberId
emailstringNoEmail address; see Data types for the format. Ignored when reporting by memberId

Response

{ "ok": true, "memberId": "mem_…", "migratedAt": "2026-10-27T08:00:00.000Z" }
FieldTypeDescription
memberIdstring | nullID of the member recorded as migrated; null if this member was never imported, in which case nothing is recorded
migratedAtstring | nullWhen the migration was first recorded; null whenever memberId is null

Notes

  • This endpoint is idempotent: reporting again with the same openId returns the first result.
  • Reporting the same member with a different openId, or an openId already linked to another member, returns 409 migrated.
  • Do not report until the member has been credited. If crediting fails, have the member jump and redeem again.
  • If crediting succeeded but the report failed, retry the report with the same jumpTokenId or memberId; the member does not need to jump or be looked up again.
  • When reporting by jumpTokenId, mobile and email are recorded only where the member's record has none; values the merchant imported take precedence. A member reported by memberId was found by its contact details, so no contact details are recorded.

Example

The new mini program reads af_token in app.js:

App({
  onShow(options) {
    const extra = (options.referrerInfo && options.referrerInfo.extraData) || {};
    const token = (options.query && options.query.af_token) || extra.af_token;
    if (token) {
      // Send it to your own backend to redeem; never call AcrossFlow from the mini program
    }
  },
});

Get the member's consent before using the migrated points and stored value.

Error codes

Error codes specific to these endpoints. For common error codes, see the API overview.

HTTPerrorEndpointDescription
401tokenredeemThe af_token is malformed, unknown, expired, already redeemed, or not from this token's channel
401tokenmigratedThe jumpTokenId is missing, malformed, unknown, or its jump token has not been redeemed
404membermigratedThe memberId does not belong to this token's channel
409migratedmigratedThe member was already reported with a different openId, or the openId is linked to another member