Creates a new refund to refund a charge that has previously been created but not yet refunded.
curl https://api.stripe.com/v1/refunds \
-u STRIPE_SECRET_KEY: \
-d charge=ch_1BnETKGswQrCoh0XE7kJI2wj
-X POST
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
DECLARE @sTmp0 nvarchar(4000)
DECLARE @rest int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Rest', @rest OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- URL: https://api.stripe.com/v1/refunds
DECLARE @bTls int
SELECT @bTls = 1
DECLARE @port int
SELECT @port = 443
DECLARE @bAutoReconnect int
SELECT @bAutoReconnect = 1
EXEC sp_OAMethod @rest, 'Connect', @success OUT, 'api.stripe.com', STR(@port), STR(@bTls), STR(@bAutoReconnect)
IF STR(@success) <> 1
BEGIN
EXEC sp_OAGetProperty @rest, 'ConnectFailReason', @iTmp0 OUT
PRINT 'ConnectFailReason: ' + @iTmp0
EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
RETURN
END
EXEC sp_OAMethod @rest, 'SetAuthBasic', @success OUT, 'STRIPE_SECRET_KEY', ''
EXEC sp_OAMethod @rest, 'AddQueryParam', @success OUT, 'charge', 'ch_1BnETKGswQrCoh0XE7kJI2wj'
DECLARE @strResponseBody nvarchar(4000)
EXEC sp_OAMethod @rest, 'FullRequestFormUrlEncoded', @strResponseBody OUT, 'POST', '/v1/refunds'
EXEC sp_OAGetProperty @rest, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 <> 1
BEGIN
EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
RETURN
END
DECLARE @jsonResponse int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @jsonResponse OUT
EXEC sp_OAMethod @jsonResponse, 'Load', @success OUT, @strResponseBody
DECLARE @id nvarchar(4000)
DECLARE @object nvarchar(4000)
DECLARE @amount int
DECLARE @balance_transaction int
DECLARE @charge nvarchar(4000)
DECLARE @created int
DECLARE @currency nvarchar(4000)
DECLARE @reason int
DECLARE @receipt_number int
DECLARE @status nvarchar(4000)
EXEC sp_OAMethod @jsonResponse, 'StringOf', @id OUT, 'id'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @object OUT, 'object'
EXEC sp_OAMethod @jsonResponse, 'IntOf', @amount OUT, 'amount'
EXEC sp_OAMethod @jsonResponse, 'IsNullOf', @balance_transaction OUT, 'balance_transaction'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @charge OUT, 'charge'
EXEC sp_OAMethod @jsonResponse, 'IntOf', @created OUT, 'created'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @currency OUT, 'currency'
EXEC sp_OAMethod @jsonResponse, 'IsNullOf', @reason OUT, 'reason'
EXEC sp_OAMethod @jsonResponse, 'IsNullOf', @receipt_number OUT, 'receipt_number'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @status OUT, 'status'
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @jsonResponse
END
GO
{
"id": "re_1BnETKGswQrCoh0XT2qLx7S0",
"object": "refund",
"amount": 100,
"balance_transaction": null,
"charge": "ch_1BnETKGswQrCoh0XE7kJI2wj",
"created": 1516662782,
"currency": "usd",
"metadata": {},
"reason": null,
"receipt_number": null,
"status": "succeeded"
}