public async Task <IActionResult> Refund(long transactionId) { var refundData = GetRefund(); var nonce = Guid.NewGuid().ToString(); var refundUrl = $"/v3/payments/{transactionId}/refund"; var requestJson = JsonConverterFacade.SerializeObject(refundData, _client.SerializerSettings); var signature = _client.GetSignature((_config.ChannelSecret + refundUrl + requestJson + nonce), _config.ChannelSecret); var result = await _client.RefundAsync(refundData, nonce, signature, transactionId); return(Ok(result)); }
public async Task <IActionResult> Reserve() { var reserveData = GetReserveData(); var nonce = Guid.NewGuid().ToString(); var requestUrl = "/v3/payments/request"; var requestJson = JsonConverterFacade.SerializeObject(reserveData, _client.SerializerSettings); var signature = _client.GetSignature((_config.ChannelSecret + requestUrl + requestJson + nonce), _config.ChannelSecret); var result = await _client.ReserveAsync(reserveData, nonce, signature); return(Ok(result)); }
public async Task <IActionResult> Confirm(long transactionId, Guid orderId) { var confirmData = GetConfirmData(); var nonce = Guid.NewGuid().ToString(); var confirmUrl = $"/v3/payments/{transactionId}/confirm"; var requestJson = JsonConverterFacade.SerializeObject(confirmData, _client.SerializerSettings); var signature = _client.GetSignature((_config.ChannelSecret + confirmUrl + requestJson + nonce), _config.ChannelSecret); var result = await _client.ConfirmAsync(confirmData, nonce, signature, transactionId); // 若不是自動請款請呼叫 _client.CaptureAsync(),如果使用非自動請款,請聯繫 LINE PAY API 相關窗口申請 return(Ok(result)); }