Validate Card Charge

This shows how to validate a card charge

< ? php

$result = array();

$postdata = array(
 'PBFPubKey' => 'FLWPUBK-7adb6177bd71dd43c2efa3f1229e3b7f-X',
 'transaction_reference' => 'FLW-MOCK-539111aa99835cbbe028b058d4c9e961',
 'otp' => '12345');

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://flw-pms-dev.eu-west-1.elasticbeanstalk.com/flwv3-pug/getpaidx/api/validatecharge");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postdata)); //Post Fields
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$headers = [
 'Content-Type: application/json',
];

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$request = curl_exec($ch);

curl_close($ch);
if ($request) {
 $result = json_decode($request, true);
}
package com.raveapi.examples.chargecard;

// import Unirest packages into your project

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;

// creating a class to handle Unirest Request
public class ChargeCard {
 public void chargeCardRave() throws Exception {
  HttpResponse < JsonNode > response = Unirest.post("http://flw-pms-dev.eu-west-1.elasticbeanstalk.com/flwv3-pug/getpaidx/api/validatecharge").
  header("Content-Type", "application/json").
  field("PBFPubKey", "FLWPUBK-e634d14d9ded04eaf05d5b63a0a06d2f-X").
  field("transaction_reference", 'FLW-MOCK-539111aa99835cbbe028b058d4c9e9661').
  field("otp", "12345").
  asJson(); // passes the request in JSON format.

  //do something with response
  response.getBody().getObject().toString(2);

 }

 public static void main(String args[]) throws Exception {
  ChargeAccount rave = new ChargeAccount();
  rave.chargeAccountRave();
 }
}
var data = new { transaction_reference = "FLW-MOCK-baa79d6a6ab92070fab73da392126fe3", PBFPubKey = "FLWSECK-e6db11d1f8a6208de8cb2f94e293450e-X", otp = "12345" };
            var client = new HttpClient();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            var responseMessage = client.PostAsJsonAsync("http://flw-pms-dev.eu-west-1.elasticbeanstalk.com/flwv3-pug/getpaidx/api/validatecharge", data).Result;
            var responseStr = responseMessage.Content.ReadAsStringAsync().Result;
            var response = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponseData>(responseStr);
            if (response.data.status == "successful" && response.data.amount == 2000)
            {
              
              System.Console.WriteLine("Perform payment verification check and give value to your customer");
               
            }
Language
Click Try It! to start a request and see the response here!