Skip to content

支付

Genstore 支付业务域是核心业务模块,通过提供一系列的 RESTful 接口,管理支付信息,支持支付流程的下单、退款动作以及支付单查询等子域。

核心功能

  • 下单:根据订单创建支付单,通知到PSP进行扣款。
  • 退款:根据售后定,退款给客户。
  • 获取单个支付单:根据订单关联的支付单ID 检索支付单的详细信息。

应用场景

  • 支付通过扩展:开发者可以通过支付开发能力将三方支付服务商接入店铺,作为三方支付渠道扩展店铺支付能力。

GET 获取退款详情

获取退款单的退款详情。

请求参数

refundIdstringrequired
Genstore退款单ID。

响应数据

channelRefundIdstringrequired
渠道侧退款单ID。
statusstringrequired
退款状态:(退款中/退款成功/失败)。
errorstring
支付通道处理失败时返回的错误信息。
bash
{
	"refundId":"1234"
}
json
HTTP/1.1 200 OK
{
  "channelRefundId": "1112",
  "error": "Refund failed",
  "status": "PROCESSING"
}

POST 创建退款

创建一笔退款申请。

请求参数

refundIdstringrequired
Genstore退款ID。
paymentIdstringrequired
Genstore退款单关联的支付单。
amountstringrequired
退款金额。
testbooleanrequired
是否测试模式。

响应数据

channelRefundIdstringrequired
渠道退款单ID。
errorstring
支付通道处理失败时返回的错误信息。
bash
{
	"amount":"100",
	"test":"true or false",
	"paymentId":"1111",
	"refundId":"1111"
}
json
HTTP/1.1 200 OK
{
  "channelRefundId": "1111",
  "error": "Refund failed."
}

GET 获取支付单详情

获取支付单的详情信息。

请求参数

paymentIdstringrequired
Genstore支付单ID。

响应数据

statusstringrequired
支付状态:(支付中/支付成功/授权成功/支付失败)。
channelPaymentIdstringrequired
渠道侧支付单 ID。
errorstring
支付通道处理失败时返回的错误信息。
bash
{
	"paymentId":"111"
}
json
HTTP/1.1 200 OK
{
  "channelPaymentId": "111",
  "error": "Not found payment information.",
  "status": "PROCESSING"
}

POST 取消捕获

创建取消捕获申请。

请求参数

voidIdstringrequired
Genstore取消捕获ID。
paymentIdstringrequired
待取消捕获支付单号。
testbooleanrequired
是否测试模式。

响应数据

channelVoidIdstring
渠道侧返回 ID。
errorstring
支付通道处理失败时返回的错误信息。
bash
{
	"test":"true or false",
	"voidId":"11122",
	"paymentId":"222"
}
json
HTTP/1.1 200 OK
{
  "channelVoidId": "xxxx",
  "error": "Cancel caputue failed"
}

POST 创建捕获

创建捕获请求。

请求参数

captureIdstringrequired
Genstore手动捕获ID。
paymentIdstringrequired
Genstore待捕获支付单号。
amountstringrequired
捕获金额。
testbooleanrequired
是否测试模式(是或否)。

响应数据

channelCaptureIdstring
支付通道侧捕获ID。
errorstring
支付通道侧捕获失败原因。
bash
{
	"amount":"200",
	"test":"true",
	"paymentId":"2222",
	"captureId":"1111"
}
json
HTTP/1.1 200 OK
{
  "channelCaptureId": "3333",
  "error": "Capture failed"
}

POST 创建信用卡支付

创建一笔使用信用卡支付的支付申请。

请求参数

paymentIdstringrequired
支付单号。
amountstringrequired
支付金额。
currencystringrequired
3位 ISO 4217货币代码。
testbooleanrequired
是否测试模式。
paymentMethodobjectrequired
支付信息。
+ 展开属性
customerobjectrequired
买家信息。
+ 展开属性
manualCapturebooleanrequired
捕获方式(false :自动,true:手动)。
clientDetailsobjectrequired
浏览器信息。
+ 展开属性
purchaseInfoobject
产品信息。
+ 展开属性

响应数据

threeDsUrlstring
当付款需要 3D-Secure 验证时返回的 URL。
errorstringrequired
支付通道处理失败时返回的错误信息。
bash
{
	"purchaseInfo":{
		"insurance":"1",
		"itemTotal":"100",
		"shipping":"1",
		"taxTotal":"1",
		"discount":"1",
		"handling":"1",
		"shippingDiscount":"0.0",
		"items":[
			{
				"unitPrice":"1.0",
				"imgUrl":"http://xxxx.com",
				"quantity":"2",
				"name":"Black Cotton T-Shirt and White Denim Shorts",
				"description":"Casual Black Cotton T-Shirt and White Denim Shorts for Everyday Wear",
				"tax":"2.0",
				"category":"1",
				"sku":"107369095352924",
				"virtualProduct":"true or false"
			}
		]
	},
	"amount":"200.00",
	"clientDetails":{
		"acceptLanguage":"zh,en-US;q=0.9,en;q=0.8,zh-CN;q=0.7",
		"ipAddress":"10.5.2.2",
		"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"
	},
	"test":"true",
	"manualCapture":"true",
	"paymentId":"PI00202410161331562671",
	"paymentMethod":{
		"data":{
			"cipherText":"I/ehfE/1SkDx/i8qJgoe/qXaRV+fyaVIeEL7D+5PWiPtOgZZAQ/GWvRbI7kgOV0dCkH/uhb0Nlq4sns6GWgf7GeiezxKjPdaJqqbdnYvb3y98SG6DWzCDTc+Za6bpkk2uAg=",
			"salt":"GENSTORE-HKDF-SALT",
			"ephemeralPublicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECYaybEr5VfuEUOTBN5iYi3FLDhVUx0s1k6K4iUqk+rgnHRovbXKlItHNzTeGSSevunb8HdQEaPclqUfAps07Uw==",
			"suit":"GENSTORE-V1",
			"returnUrl":"https://www.xxx.shop/pay/result",
			"iv":"GUdwmcbLCp+4hHMr"
		}
	},
	"currency":"USD",
	"customer":{
		"phoneNumber":"+8618800008888",
		"shippingAddress":{
			"phoneNumber":"+8615885555",
			"province":"NY",
			"city":"Westbury",
			"countryCode":"US",
			"givenName":"John",
			"familyName":"Smith",
			"postalCode":"10013",
			"company":"IBM",
			"line2":"Apartment 5",
			"line1":"2063  Marshville Road"
		},
		"billingAddress":{
			"phoneNumber":"+8615885555",
			"province":"NY",
			"city":"Westbury",
			"countryCode":"US",
			"givenName":"John",
			"familyName":"Smith",
			"postalCode":"10013",
			"company":"IBM",
			"line2":"Apartment 5",
			"line1":"2063  Marshville Road"
		},
		"email":"xxx@gmail.com"
	}
}
json
HTTP/1.1 200 OK
{
  "error": "Payment failed",
  "threeDsUrl": "http://xxx.com"
}

POST 创建离站支付

创建一笔跳转至第三方网站的支付单。

请求参数

paymentIdstringrequired
支付单ID。
amountstringrequired
支付金额。
currencystringrequired
币种。
testbooleanrequired
是否测试模式。
paymentMethodobjectrequired
支付信息。
+ 展开属性
customerobjectrequired
买家信息。
+ 展开属性
manualCapturebooleanrequired
捕获方式(false:自动,true: 手动)。
purchaseInfoobjectrequired
产品信息。
+ 展开属性

响应数据

redirectUrlstringrequired
支付通道返回的付款地址。
errorstringrequired
支付通道处理失败时返回的错误信息。
bash
{
	"purchaseInfo":{
		"insurance":"0.0",
		"itemTotal":"50.0",
		"shipping":"0.0",
		"taxTotal":"5.5",
		"discount":"0.0",
		"handling":"0.0",
		"shippingDiscount":"0.0",
		"items":[
			{
				"unitPrice":"1.0",
				"imgUrl":"http://xx.com",
				"quantity":"2",
				"name":"Black Cotton T-Shirt and White Denim Shorts",
				"description":"Casual Black Cotton T-Shirt and White Denim Shorts for Everyday Wear",
				"tax":"1.0",
				"category":"1",
				"sku":"107369095352924",
				"virtualProduct":"true"
			}
		]
	},
	"amount":"100.80",
	"test":"true",
	"manualCapture":"true",
	"paymentId":"PI00202410161331562671344",
	"paymentMethod":{
		"data":{
			"cancelUrl":"http://test.genstore.ai/xx",
			"returnUrl":"https://www.xxx.shop/pay/result"
		}
	},
	"currency":"USD",
	"customer":{
		"phoneNumber":"+8618800008888",
		"shippingAddress":{
			"phoneNumber":"+8618800008888",
			"province":"NY",
			"city":"New York",
			"countryCode":"US",
			"givenName":"John",
			"familyName":"Smith",
			"postalCode":"10013",
			"company":"IBM",
			"line2":"Apartment 5",
			"line1":"2063  Marshville Road"
		},
		"billingAddress":{
			"phoneNumber":"+8618800008888",
			"province":"NY",
			"city":"New York",
			"countryCode":"US",
			"givenName":"John",
			"familyName":"Smith",
			"postalCode":"10013",
			"company":"inter",
			"line2":"Apartment 5",
			"line1":"2063  Marshville Road"
		},
		"email":"xx@gmail.com"
	}
}
json
HTTP/1.1 200 OK
{
  "redirectUrl": "https://www.xxx.com/",
  "error": "Transaction do not honor"
}