diff --git a/README.md b/README.md index 989ad10..1cd0cdc 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,12 @@ cd src/ php examples/capture_credit_card_payment_example.php [external_id] [token_id] [amount] ``` +# Capture credit card payment with authentication id +``` +cd src/ +php examples/capture_credit_card_payment_with_authentication_id_example.php [external_id] [token_id] [amount] [authentication_id] +``` + # Name validator ``` cd src/ diff --git a/src/XenditPHPClient.php b/src/XenditPHPClient.php index 1618e0a..5ec1940 100644 --- a/src/XenditPHPClient.php +++ b/src/XenditPHPClient.php @@ -96,7 +96,7 @@ function getVirtualAccountBanks () { curl_close($curl); $responseObject = json_decode($response, true); - return $responseObject; + return $responseObject; } function createCallbackVirtualAccount ($external_id, $bank_code, $name, $virtual_account_number = null) { @@ -168,7 +168,7 @@ function getAvailableDisbursementBanks () { curl_close($curl); $responseObject = json_decode($response, true); - return $responseObject; + return $responseObject; } function getInvoice ($invoice_id) { @@ -211,7 +211,7 @@ function getBalance () { return $responseObject; } - function captureCreditCardPayment ($external_id, $token_id, $amount, $authenticationId = null) { + function captureCreditCardPayment ($external_id, $token_id, $amount, $capture_options = null) { $curl = curl_init(); $headers = array(); @@ -222,7 +222,18 @@ function captureCreditCardPayment ($external_id, $token_id, $amount, $authentica $data['external_id'] = $external_id; $data['token_id'] = $token_id; $data['amount'] = $amount; - $data['authentication_id'] = $authenticationId; + + if (!empty($capture_options['authentication_id'])) { + $data['authentication_id'] = $capture_options['authentication_id']; + } + + if (!empty($capture_options['card_cvn'])) { + $data['card_cvn'] = $capture_options['card_cvn']; + } + + if (!empty($capture_options['capture'])) { + $data['capture'] = $capture_options['capture']; + } $payload = json_encode($data); diff --git a/src/examples/capture_credit_card_payment_with_options_example.php b/src/examples/capture_credit_card_payment_with_options_example.php new file mode 100644 index 0000000..2a464e2 --- /dev/null +++ b/src/examples/capture_credit_card_payment_with_options_example.php @@ -0,0 +1,17 @@ +captureCreditCardPayment($external_id, $token_id, $amount, $capture_options); + + print_r($response); +?>