alipay.marketing.card.delete
Use this interface to delete membership cards.
Request
Service address
Environment | HTTPS request URL |
Production environment |
Request parameters
Parameter | Description |
Basic parameter | |
app_id String (32) | The unique ID that is assigned by Alipay to identify an app
|
method String (128) | The interface name
|
format String (40) | Only JSON is supported.
|
charset String (10) | The charset with which the request data are encoded. UTF-8, GBK, and GB2312 are supported.
|
sign_type String (10) | The signature algorithm used by the merchant to generate the pre-sign string. RSA and RSA2 are supported. RSA2 is preferred.
|
sign String (344) | The sign value. See Signature for details.
|
timestamp String (19) | The time when the request is sent. The format is yyyy-MM-dd HH:mm:ss.
|
version String (3) | The interface version. The value is fixed as 1.0.
|
biz_content | Collection of request parameters. The maximum length is not limited. Except for basic parameters, all other request parameters must be passed to this parameter. |
Business parameter | |
out_serial_no String (32) | The unique serial number that is assigned by the merchant to identify a card deletion request
|
target_card_no String (32) | The membership card number that is assigned by Alipay, identical to biz_card_no in the response of alipay.marketing.card.open.
|
target_card_no_type String (32) | The type of the card number, with a value of BIZ_CARD to indicate a card number that is assigned by Alipay.
|
reason_code String (32) | The reason to delete the membership card. Possible values are:
|
ext_info String (1024) | Extended information, in the JSON format. This field can be used for passing specific business information when the merchant and Alipay agree on how to use this field. The following keys are supported: new_card_no: the new card number donee_user_id: the user ID of the donee
|
Response
Parameter | Description |
Basic parameter | |
code String | Gateway return code, which indicates whether the request is accepted by Alipay gateway.
|
msg String | Description of the gateway return code
|
sub_code String | Processing result of the request
|
sub_msg String | Description of the processing result of the request
|
sign String | The signature value. See Signature for details.
|
Business parameter | |
biz_serial_no String (32) | The unique serial number that is assigned by Alipay to identify a card deletion request
|
Error codes
Returned result | Description | Solution |
INVALID_PARAMETER | Incorrect parameters | Check the problem according to the message. |
SYSTEM_ERROR | Alipay system error | Try again. |
CARD_NOT_EXIT | The membership card does not exist. | Check the information about the membership card. |
NO_CARD_TYPE | The card type is not defined. | Use the correct card type. |
CARD_IS_DELETED_ALREADY | The membership card has already been deleted. | No action is needed because the membership card has already been deleted successfully. |
Sample
Request sample
Java
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2");
AlipayMarketingCardDeleteRequest request = new AlipayMarketingCardDeleteRequest();
request.setBizContent("{" +
"\"out_serial_no\":\"2016062700001\"," +
"\"target_card_no\":\"0000001\"," +
"\"target_card_no_type\":\"BIZ_CARD\"," +
"\"reason_code\":\"USER_UNBUND\"," +
"\"ext_info\":\"{\\\"new_card_no\\\":\\\"12345\\\",\\\" donee_user_id\\\":\\\"2088102130652460\\\"}\"" +
" }");
AlipayMarketingCardDeleteResponse response = alipayClient.execute(request);
if(response.isSuccess()){
System.out.println("The calling is successful.");
} else {
System.out.println("The calling is failed.");
}
.NET
IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", "app_id", "merchant_private_key", "json", "1.0", "RSA2", "alipay_public_key", "GBK", false);
AlipayMarketingCardDeleteRequest request= new AlipayMarketingCardDeleteRequest() ;
request.BizContent="{" +
"\"out_serial_no\":\"2016062700001\"," +
"\"target_card_no\":\"0000001\"," +
"\"target_card_no_type\":\"BIZ_CARD\"," +
"\"reason_code\":\"USER_UNBUND\"," +
"\"ext_info\":\"{\\\"new_card_no\\\":\\\"12345\\\",\\\" donee_user_id\\\":\\\"2088102130652460\\\"}\"" +
" }";
AlipayMarketingCardDeleteResponse response=client.execute(request);
Console.WriteLine(response.Body);
PHP
$aop = new AopClient ();
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
$aop->appId = 'your app_id';
$aop->rsaPrivateKey = 'Please fill in the developer's private key in a line of string, removing the head, tail, and carriage return';
$aop->alipayrsaPublicKey='Please fill in Alipay public key in a line of string';
$aop->apiVersion = '1.0';
$aop->signType = 'RSA2';
$aop->postCharset='GBK';
$aop->format='json';
$request = new AlipayMarketingCardDeleteRequest ();
$request->setBizContent("{" .
"\"out_serial_no\":\"2016062700001\"," .
"\"target_card_no\":\"0000001\"," .
"\"target_card_no_type\":\"BIZ_CARD\"," .
"\"reason_code\":\"USER_UNBUND\"," .
"\"ext_info\":\"{\\\"new_card_no\\\":\\\"12345\\\",\\\" donee_user_id\\\":\\\"2088102130652460\\\"}\"" .
" }");
$result = $aop->execute ( $request);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$resultCode = $result->$responseNode->code;
if(!empty($resultCode)&&$resultCode == 10000){
echo "Success";
} else {
echo "Fail";
}
HTTP request source code
https://openapi.alipay.com/gateway.do?timestamp=2013-01-01 08:08:08&method=alipay.marketing.card.delete&app_id=15638&sign_type=RSA2&sign=ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE&version=1.0&charset=GBK&biz_content=
{
"out_serial_no":"2016062700001",
"target_card_no":"0000001",
"target_card_no_type":"BIZ_CARD",
"reason_code":"USER_UNBUND",
"ext_info":"{\"new_card_no\":\"12345\",\" donee_user_id\":\"2088102130652460\"}"
}
Response sample
JSON
{
"alipay_marketing_card_delete_response": {
"code": "10000",
"msg": "Success",
"biz_serial_no": "2016062700001"
},
"sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
}
XML
<alipay_marketing_card_delete_response>
<code>10000</code>
<msg>Success</msg> <biz_serial_no>2016062700001</biz_serial_no>
</alipay_marketing_card_delete_response>
Exception sample
JSON
{
"alipay_marketing_card_delete_response": {
"code": "20000",
"msg": "Service Currently Unavailable",
"sub_code": "isp.unknow-error",
"sub_msg": "The system is busy."
},
"sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
}