Token导航 LogoToken导航

Agent Skill · 开发

webpay-api(webpay API 文档)

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

webpay-api 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有未通过项,按安装量在开发类的 21,746 个 Skill 里排第 17,767。

总安装 380周安装 16GitHub Stars 公开资料未说明下载 133核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:webpay-api(webpay API 文档)
来源仓库:https://github.com/xoverlap/webpay-skill
仓库路径:skills/webpay-api
安装命令:
npx skills add https://github.com/xoverlap/webpay-skill --skill webpay-api
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/xoverlap/webpay-skill --skill webpay-api

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

webpay-api 用于辅助 API 设计、接口文档和请求响应结构梳理,适合前后端联调和 OpenAPI 草稿生成。它支持梳理 endpoint、生成接口文档、检查字段命名和错误码整理,帮助 Agent 完成 API 集成说明。

通过 npx skills add 命令从指定 GitHub 仓库安装,具体用法需结合真实业务语义调整。涉及生成接口文档时应避免凭空补字段,最好从现有代码或接口样例中提取事实。webpay-api 属于开发类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/webpay-api

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/xoverlap/webpay-skill --skill webpay-api;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

webpay-api 怎么安装?

在终端执行 npx skills add https://github.com/xoverlap/webpay-skill --skill webpay-api。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

webpay-api 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

webpay-api 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

webpay-api 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

webpay-api 用的人多吗?

公开数据是累计安装 380 次,近一周安装 16 次,下载 133 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

webpay-api 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
webpay-api

webpay API 文档 · 本页

380—接触敏感数据未明确未通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Webpay Plus - REST API Integration Skill

This skill provides everything needed to integrate the Transbank Webpay Plus payment gateway using its REST API (HTTP). It covers the complete purchase cycle: creating transactions, confirming payments, checking status, refunding/reversing, and deferred capture.

This skill covers Webpay Plus only (single-store). It does NOT cover Webpay Plus Mall (multi-store) or Oneclick.

Table of Contents

  1. Environments and Credentials
  2. Payment Flow Overview
  3. API Endpoints

- Create Transaction - Confirm Transaction (Commit) - Get Transaction Status - Refund / Reverse Transaction - Capture Transaction (Deferred)

  1. Reference Tables
  2. Error Codes
  3. Going to Production

Environments and Credentials

The Webpay REST API is secured via TLSv1.2 and authenticated using two HTTP headers on every request:

HeaderDescription
Tbk-Api-Key-IdCommerce code (codigo de comercio)
Tbk-Api-Key-SecretSecret key (llave secreta)

All requests must also include Content-Type: application/json.

Environments

EnvironmentBase URL
Integration (testing)https://webpay3gint.transbank.cl
Productionhttps://webpay3g.transbank.cl

Integration Test Credentials

Use these credentials freely for testing in the integration environment:

Tbk-Api-Key-Id: 597055555532
Tbk-Api-Key-Secret: 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C

Test Cards for Integration

For testing in the integration environment, use the test cards documented at https://www.transbankdevelopers.cl/documentacion/como_empezar#ambientes

Common test data for a successful transaction:

  • Card number: 4051 8856 0044 6623
  • Expiration date: Any future date
  • CVV: 123
  • RUT: 11.111.111-1
  • Password: 123

To simulate a rejected transaction, use RUT 11.111.111-1 with password 123 but reject the payment in the Webpay form.

Commerce Codes for Integration

ProductCommerce Code
Webpay Plus597055555532
Webpay Plus (Deferred Capture)597055555540

Payment Flow Overview

The Webpay Plus payment cycle follows this sequence:

1. MERCHANT SERVER                    2. WEBPAY (Transbank)
   |                                     |
   |-- POST /transactions -------------->|  (Create transaction)
   |<-- { token, url } ------------------|
   |                                     |
   |-- Redirect user to url + token ---->|  (User pays on Webpay form)
   |                                     |
   |<-- Redirect to return_url ----------|  (Webpay sends token_ws via POST)
   |                                     |
   |-- PUT /transactions/{token} ------->|  (Confirm / Commit transaction)
   |<-- { transaction result } ----------|
   |                                     |
   |-- Show result to user              |

Step-by-step:

  1. Create transaction: Your server calls POST /rswebpaytransaction/api/webpay/v1.2/transactions with the order details. You receive a token and a url.
  2. Redirect to Webpay: Redirect the user's browser to the returned url, passing the token via a form POST field called token_ws: <form method="POST" action="{url}"> <input type="hidden" name="token_ws" value="{token}"> <input type="submit" value="Pagar"> </form>
  3. User pays: The user enters their card details on Transbank's secure form and authorizes the payment.
  4. Webpay redirects back: After authorization (or rejection/abort), Webpay redirects the user back to your return_url via POST, sending:

- token_ws: The transaction token (if the user completed the flow) - TBK_TOKEN + TBK_ORDEN_COMPRA + TBK_ID_SESION: Only if the user aborted the payment

  1. Confirm transaction: Your server calls PUT /rswebpaytransaction/api/webpay/v1.2/transactions/{token} to confirm and get the result.
  2. Show result: Display the payment result to the user.

Handling Aborted Payments

If the user clicks "Anular" (cancel) on the Webpay form, the redirect to return_url will include TBK_TOKEN, TBK_ORDEN_COMPRA, and TBK_ID_SESION instead of token_ws. In this case, the transaction was NOT completed. Do not call commit; inform the user that payment was cancelled.

Timeout Behavior

If the user does not complete the payment within the allowed time, two requests arrive at return_url:

  1. First with TBK_TOKEN, TBK_ORDEN_COMPRA, TBK_ID_SESION (and empty token_ws)
  2. A second request with just TBK_TOKEN (a POST from the user's browser)

Both indicate the transaction was abandoned. Do not confirm the transaction.


API Endpoints

All endpoint paths are relative to the base URL for the chosen environment.

Base path: /rswebpaytransaction/api/webpay/v1.2

1. Create Transaction

Initialize a Webpay Plus payment. Returns a token and URL for the payment form.

Endpoint: POST /rswebpaytransaction/api/webpay/v1.2/transactions

Request Headers:

Tbk-Api-Key-Id: 597055555532
Tbk-Api-Key-Secret: 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C
Content-Type: application/json

Request Body:

{
  "buy_order": "ordenCompra12345678",
  "session_id": "sesion1234557545",
  "amount": 10000,
  "return_url": "http://www.comercio.cl/webpay/retorno"
}

Request Parameters:

ParameterTypeDescription
buy_orderStringUnique order ID for this transaction. Max length: 26. Allowed chars: letters, numbers, and `\_=&%.,~:/?[+!@()>-`
session_idStringSession identifier, for internal use by the merchant. Returned at the end of the transaction. Max length: 61
amountDecimalTransaction amount. Integer for CLP, max 2 decimals for USD. Max length: 17
return_urlStringURL where Webpay redirects after authorization. Max length: 256

Response (200 OK):

{
  "token": "e9d555262db0f989e49d724b4db0b0af367cc415cde41f500a776550fc5fddd3",
  "url": "https://webpay3gint.transbank.cl/webpayserver/initTransaction"
}

Response Fields:

FieldTypeDescription
tokenStringTransaction token. Length: 64
urlStringWebpay payment form URL. Max length: 255

2. Confirm Transaction (Commit)

After the user completes payment on Webpay and is redirected to return_url, confirm the transaction. This is mandatory to finalize the payment.

Endpoint: PUT /rswebpaytransaction/api/webpay/v1.2/transactions/{token}

Request Headers:

Tbk-Api-Key-Id: 597055555532
Tbk-Api-Key-Secret: 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C
Content-Type: application/json

URL Parameters:

ParameterTypeDescription
tokenStringTransaction token (in the URL path, not body). Length: 64

No request body is needed.

Response (200 OK):

{
  "vci": "TSY",
  "amount": 10000,
  "status": "AUTHORIZED",
  "buy_order": "ordenCompra12345678",
  "session_id": "sesion1234557545",
  "card_detail": {
    "card_number": "6623"
  },
  "accounting_date": "0522",
  "transaction_date": "2019-05-22T16:41:21.063Z",
  "authorization_code": "1213",
  "payment_type_code": "VN",
  "response_code": 0,
  "installments_number": 0
}

Response Fields:

FieldTypeDescription
vciStringCardholder authentication result. See VCI Codes
amountDecimalTransaction amount. Max length: 17
statusStringTransaction status. See Transaction Statuses
buy_orderStringOrder ID sent in create. Max length: 26
session_idStringSession ID sent in create. Max length: 61
card_detailObjectCard details object
card_detail.card_numberStringLast 4 digits of the card. Max length: 19
accounting_dateStringAuthorization date. Length: 4, format: MMDD
transaction_dateStringAuthorization date/time. ISO 8601 format
authorization_codeStringAuthorization code. Max length: 6
payment_type_codeStringPayment type. See Payment Type Codes
response_codeNumberAuthorization response code. 0 = approved
installments_amountNumberInstallment amount. Max length: 17
installments_numberNumberNumber of installments. Max length: 2
balanceNumberRemaining balance for a nullified detail. Max length: 17

Validating a Successful Transaction

After calling commit, verify the transaction was successful by checking:

  1. response_code equals 0
  2. status equals "AUTHORIZED"

If response_code is not 0, the transaction was rejected.


3. Get Transaction Status

Query the state of a transaction at any time. Useful for error recovery or verifying a transaction's current state.

Endpoint: GET /rswebpaytransaction/api/webpay/v1.2/transactions/{token}

Request Headers:

Tbk-Api-Key-Id: 597055555532
Tbk-Api-Key-Secret: 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C
Content-Type: application/json

URL Parameters:

ParameterTypeDescription
tokenStringTransaction token (in URL, not body). Length: 64

Response: Same structure as Commit response (see above).


4. Refund / Reverse Transaction

Refund all or part of a completed transaction. If called within the same day as the original transaction, it may result in a reversal (REVERSED). If called on a different day, it becomes a nullification (NULLIFIED).

Endpoint: POST /rswebpaytransaction/api/webpay/v1.2/transactions/{token}/refunds

Request Headers:

Tbk-Api-Key-Id: 597055555532
Tbk-Api-Key-Secret: 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C
Content-Type: application/json

URL Parameters:

ParameterTypeDescription
tokenStringTransaction token (in URL, not body). Length: 64

Request Body:

{
  "amount": 1000
}

Request Parameters:

ParameterTypeDescription
amountDecimalAmount to refund/reverse. Integer for CLP, max 2 decimals for USD. Max length: 17

Response (200 OK) - Nullification:

{
  "type": "NULLIFIED",
  "authorization_code": "123456",
  "authorization_date": "2019-03-20T20:18:20Z",
  "nullified_amount": 1000.00,
  "balance": 0.00,
  "response_code": 0
}

Response (200 OK) - Reversal:

{
  "type": "REVERSED"
}

Response Fields:

FieldTypeDescription
typeStringRefund type: REVERSED or NULLIFIED. Max length: 10
authorization_codeString(NULLIFIED only) Authorization code. Max length: 6
authorization_dateString(NULLIFIED only) Authorization date/time
balanceDecimal(NULLIFIED only) Updated balance. Max length: 17
nullified_amountDecimal(NULLIFIED only) Amount nullified. Max length: 17
response_codeNumber(NULLIFIED only) Result code. 0 = success. Max: 2

Refund Error Codes:

CodeDescription
304Null input field validation
245Commerce code does not exist
22Commerce is not active
316Commerce does not match certificate
308Operation not allowed
274Transaction not found
16Transaction does not allow nullification
292Transaction is not authorized
284Nullification period exceeded
310Transaction already nullified
311Amount exceeds available balance to nullify
312Generic nullification error
315Authorizer error
53Transaction does not allow partial nullification with installments

5. Capture Transaction (Deferred)

For merchants configured with deferred capture, this endpoint captures a previously authorized transaction. Requires a specific commerce code for deferred capture.

Integration commerce code for deferred capture: 597055555540

Endpoint: PUT /rswebpaytransaction/api/webpay/v1.2/transactions/{token}/capture

Request Headers:

Tbk-Api-Key-Id: 597055555540
Tbk-Api-Key-Secret: 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C
Content-Type: application/json

URL Parameters:

ParameterTypeDescription
tokenStringTransaction token (in URL, not body). Length: 64

Request Body:

{
  "buy_order": "415034240",
  "authorization_code": "12345",
  "capture_amount": 1000
}

Request Parameters:

ParameterTypeDescription
buy_orderStringOrder ID of the transaction to capture. Max length: 26
authorization_codeStringAuthorization code from the original transaction. Max length: 6
capture_amountDecimalAmount to capture. Max length: 17

Response (200 OK):

{
  "token": "e074d38c628122c63e5c0986368ece22974d6fee1440617d85873b7b4efa48a3",
  "authorization_code": "123456",
  "authorization_date": "2019-03-20T20:18:20Z",
  "captured_amount": 1000,
  "response_code": 0
}

Response Fields:

FieldTypeDescription
tokenStringTransaction token. Max length: 64
authorization_codeStringDeferred capture authorization code. Max length: 6
authorization_dateStringAuthorization date/time
captured_amountDecimalCaptured amount. Max length: 6
response_codeNumberResult code. 0 = success. Max: 2

Capture Error Codes:

CodeDescription
304Null input field validation
245Commerce code does not exist
22Commerce is not active
316Commerce does not match certificate
308Operation not allowed
274Transaction not found
16Transaction is not deferred capture
292Transaction is not authorized
284Capture period exceeded
310Transaction previously reversed
309Transaction previously captured
311Capture amount exceeds authorized amount
315Authorizer error

Reference Tables

Transaction Statuses

StatusDescription
INITIALIZEDTransaction has been created, waiting for user to complete payment
AUTHORIZEDTransaction was authorized successfully
REVERSEDTransaction was reversed (same-day refund)
FAILEDTransaction was rejected or failed
NULLIFIEDTransaction was nullified (refund after accounting date)
PARTIALLY_NULLIFIEDTransaction was partially nullified
CAPTUREDTransaction was captured (deferred capture)

Payment Type Codes

CodeDescription
VDDebit Sale (Venta Debito)
VNNormal Sale - Credit (Venta Normal)
VCInstallment Sale (Venta en Cuotas)
SI3 interest-free installments (3 Cuotas sin Interes)
S22 interest-free installments (2 Cuotas sin Interes)
NCN interest-free installments (N Cuotas sin Interes)
VPPrepaid Sale (Venta Prepago)

VCI Codes

The vci field indicates cardholder authentication results. This is supplementary information to response_code. Merchants should NOT validate this field as new codes are constantly added.

Domestic transactions:

CodeDescription
TSYAuthentication successful
TSNAuthentication rejected
NPNon-participating, no authentication
U3Connection failure, authentication rejected
INVInvalid data
AAttempted
CNP1Commerce does not participate
EOPOperational error
BNABIN not enrolled
ENAIssuer not enrolled

Foreign sale codes:

CodeDescription
TSYSSuccessful frictionless authentication
TSASAttempt, card not enrolled / issuer unavailable
TSNSFailed, not authenticated, denied
TSRSAuthentication rejected, frictionless
TSUSAuthentication failed due to technical issue
TSCFChallenge authentication (not accepted by commerce)
TSYFSuccessful challenge authentication
TSNFNot authenticated, denied with challenge
TSUFChallenge authentication failed due to technical issue
NPCCommerce does not participate
NPBBIN does not participate
NPCBCommerce and BIN do not participate
SPCBCommerce and BIN participate, authorization incomplete

Error Codes

HTTP Status Codes

HTTP CodeDescription
200Operation executed successfully
204DELETE operation executed successfully
400Invalid JSON message (malformed or unexpected field)
401Unauthorized. Invalid API Key and/or API Secret
404Transaction not found
405Method not allowed
406Cannot process response in requested format
415Message type not allowed
422Request cannot be processed (data validation or business logic)
500Unexpected error

All errors return a JSON body:

{
  "error_message": "token is required"
}

Going to Production

To move from integration to production:

  1. Complete the certification process with Transbank
  2. Obtain your production commerce code and API secret
  3. Change the base URL from https://webpay3gint.transbank.cl to https://webpay3g.transbank.cl
  4. Replace the integration credentials with your production credentials

More details at https://www.transbankdevelopers.cl/documentacion/como_empezar#puesta-en-produccion


Implementation Examples

Node.js / Express Backend Example

const express = require('express');
const axios = require('axios');

const app = express();
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

// Configuration
const WEBPAY_BASE_URL = 'https://webpay3gint.transbank.cl'; // Use production URL for prod
const API_KEY_ID = '597055555532';
const API_KEY_SECRET = '579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C';

const headers = {
  'Tbk-Api-Key-Id': API_KEY_ID,
  'Tbk-Api-Key-Secret': API_KEY_SECRET,
  'Content-Type': 'application/json'
};

// Step 1: Create transaction
app.post('/api/webpay/create', async (req, res) => {
  try {
    const { buy_order, session_id, amount, return_url } = req.body;

    const response = await axios.post(
      `${WEBPAY_BASE_URL}/rswebpaytransaction/api/webpay/v1.2/transactions`,
      { buy_order, session_id, amount, return_url },
      { headers }
    );

    // Return token and url to frontend
    res.json(response.data);
  } catch (error) {
    res.status(error.response?.status || 500).json({
      error: error.response?.data || 'Error creating transaction'
    });
  }
});

// Step 2: Confirm transaction (return_url handler)
app.post('/api/webpay/confirm', async (req, res) => {
  try {
    const token_ws = req.body.token_ws;

    // Check if payment was aborted
    if (!token_ws || req.body.TBK_TOKEN) {
      return res.redirect('/payment-cancelled');
    }

    const response = await axios.put(
      `${WEBPAY_BASE_URL}/rswebpaytransaction/api/webpay/v1.2/transactions/${token_ws}`,
      null,
      { headers }
    );

    const result = response.data;

    // Validate successful transaction
    if (result.response_code === 0 && result.status === 'AUTHORIZED') {
      // Payment successful - update your database
      res.redirect(`/payment-success?order=${result.buy_order}`);
    } else {
      // Payment rejected
      res.redirect(`/payment-rejected?order=${result.buy_order}`);
    }
  } catch (error) {
    res.redirect('/payment-error');
  }
});

// Check transaction status
app.get('/api/webpay/status/:token', async (req, res) => {
  try {
    const response = await axios.get(
      `${WEBPAY_BASE_URL}/rswebpaytransaction/api/webpay/v1.2/transactions/${req.params.token}`,
      { headers }
    );
    res.json(response.data);
  } catch (error) {
    res.status(error.response?.status || 500).json({
      error: error.response?.data || 'Error checking status'
    });
  }
});

// Refund transaction
app.post('/api/webpay/refund', async (req, res) => {
  try {
    const { token, amount } = req.body;

    const response = await axios.post(
      `${WEBPAY_BASE_URL}/rswebpaytransaction/api/webpay/v1.2/transactions/${token}/refunds`,
      { amount },
      { headers }
    );
    res.json(response.data);
  } catch (error) {
    res.status(error.response?.status || 500).json({
      error: error.response?.data || 'Error refunding transaction'
    });
  }
});

Frontend Redirect Example

<!-- After receiving token and url from your backend -->
<form id="webpay-form" method="POST" action="">
  <input type="hidden" name="token_ws" id="token_ws">
  <button type="submit">Pagar con Webpay</button>
</form>

<script>
async function initiatePayment(orderData) {
  const response = await fetch('/api/webpay/create', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      buy_order: orderData.orderId,
      session_id: orderData.sessionId,
      amount: orderData.amount,
      return_url: window.location.origin + '/api/webpay/confirm'
    })
  });

  const { token, url } = await response.json();

  // Redirect to Webpay payment form
  const form = document.getElementById('webpay-form');
  form.action = url;
  document.getElementById('token_ws').value = token;
  form.submit();
}
</script>

cURL Examples

Create transaction:

curl -X POST "https://webpay3gint.transbank.cl/rswebpaytransaction/api/webpay/v1.2/transactions" \
  -H "Tbk-Api-Key-Id: 597055555532" \
  -H "Tbk-Api-Key-Secret: 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C" \
  -H "Content-Type: application/json" \
  -d '{
    "buy_order": "order123",
    "session_id": "session456",
    "amount": 10000,
    "return_url": "http://localhost:3000/webpay/confirm"
  }'

Confirm transaction:

curl -X PUT "https://webpay3gint.transbank.cl/rswebpaytransaction/api/webpay/v1.2/transactions/{token}" \
  -H "Tbk-Api-Key-Id: 597055555532" \
  -H "Tbk-Api-Key-Secret: 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C" \
  -H "Content-Type: application/json"

Get transaction status:

curl -X GET "https://webpay3gint.transbank.cl/rswebpaytransaction/api/webpay/v1.2/transactions/{token}" \
  -H "Tbk-Api-Key-Id: 597055555532" \
  -H "Tbk-Api-Key-Secret: 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C" \
  -H "Content-Type: application/json"

Refund:

curl -X POST "https://webpay3gint.transbank.cl/rswebpaytransaction/api/webpay/v1.2/transactions/{token}/refunds" \
  -H "Tbk-Api-Key-Id: 597055555532" \
  -H "Tbk-Api-Key-Secret: 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C" \
  -H "Content-Type: application/json" \
  -d '{"amount": 5000}'

Capture (deferred):

curl -X PUT "https://webpay3gint.transbank.cl/rswebpaytransaction/api/webpay/v1.2/transactions/{token}/capture" \
  -H "Tbk-Api-Key-Id: 597055555540" \
  -H "Tbk-Api-Key-Secret: 579B532A7440BB0C9079DED94D31EA1615BACEB56610332264630D42D0A36B1C" \
  -H "Content-Type: application/json" \
  -d '{
    "buy_order": "order123",
    "authorization_code": "123456",
    "capture_amount": 10000
  }'

Important Implementation Notes

  1. The buy_order must be unique for each transaction. It cannot be reused.
  2. Always confirm (commit) the transaction after receiving the redirect. If you don't call commit, the transaction remains in INITIALIZED state and the payment will not be processed.
  3. Commit has a time limit: You must confirm the transaction within a few seconds after the user is redirected back. If too much time passes, the transaction may expire.
  4. Handle all redirect scenarios at your return_url:

- token_ws present: Normal flow, proceed to commit - TBK_TOKEN present (no token_ws): User aborted - Both present with empty token_ws: Timeout

  1. Refund vs Reversal: The API automatically determines whether to reverse (same day, before accounting cutoff) or nullify (after accounting cutoff). You always call the same endpoint.
  2. Partial refunds are supported: You can refund any amount up to the original transaction amount. Multiple partial refunds are allowed until the balance reaches zero.
  3. Deferred capture requires a special commerce code and configuration with Transbank. Not all merchants have this feature enabled.
  4. The vci field should NOT be used for business logic validation. Use response_code instead. The vci field is informational only and new values are added without documentation updates.
  5. The response_code is the definitive indicator of whether a transaction was approved (0) or rejected (non-zero).

平台分布

Codex

35.34%
按下载量换算47

Claude

32.33%
按下载量换算43

Cursor

18.9%
按下载量换算25

Gemini CLI

9.15%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills