Validate Account Charge

< ? php

$result = array();

$postdata = array(
 'PBFPubKey' => 'FLWPUBK-7adb6177bd71dd43c2efa3f1229e3b7f-X',
 'transactionreference' => 'ACHG-1501266916412',
 'otp' => '12345');

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://flw-pms-dev.eu-west-1.elasticbeanstalk.com/flwv3-pug/getpaidx/api/validate");
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/validate").
  header("Content-Type", "application/json").
  field("PBFPubKey", "FLWPUBK-e634d14d9ded04eaf05d5b63a0a06d2f-X").
  field("transactionreference", 'ACHG-1501266916412').
  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 { transactionreference = "ACHG-1501266637278", 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/validate", 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!