Created
May 26, 2016 21:20
-
-
Save MrCoffey/18d358000170bee84c7bd8c75a68fda2 to your computer and use it in GitHub Desktop.
Tpaga Card Tokenize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.IOException; | |
| import org.apache.http.client.fluent.*; | |
| import org.apache.http.entity.ContentType; | |
| public class SendRequest | |
| { | |
| public static void main(String[] args) { | |
| sendRequest(); | |
| } | |
| private static void sendRequest() { | |
| // My API (POST ) | |
| try { | |
| // Create request | |
| Content content = Request.Post("https://sandbox.tpaga.co/api/tokenize/credit_card") | |
| // Add headers | |
| .addHeader("Cookie", "JSESSIONID=ED3C3B4C34725BF144ADFF8E38C15113; AWSELB=19318121126A5B69695188D35750824B17EAA247679C0BE61EC84A863B523B1F2C04D3AC8AD397392B7EFEA95389F12DF1D72AF05FFA3DC737CA146433315E44135A605A30") | |
| .addHeader("Authorization", "Basic pk_test_qvbvuthlvqpijnr0elmtg5jh | |
| ") | |
| .addHeader("Content-Type", "application/json; charset=utf-8") | |
| // Add body | |
| .bodyString("{\"cardHolderName\": \"John Smith\",\"expirationYear\": \"2020\",\"expirationMonth\": \"08\",\"primaryAccountNumber\": \"4111111111111111\"}", ContentType.APPLICATION_JSON) | |
| // Fetch request and return content | |
| .execute().returnContent(); | |
| // Print content | |
| System.out.println(content); | |
| } | |
| catch (IOException e) { System.out.println(e); } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment