Git Product home page Git Product logo

quickpay-v10's Introduction

Quickpay V10

Features:

  • Access the Quickpay API
    • Payments
    • Subscriptions
    • Cards
    • Payouts
    • Brandings
  • Generate payment links
  • Validate callbacks
  • Generate payment forms

Go to the official QuickPay documentation to explore all endpoints and options: http://tech.quickpay.net/api/services/?scope=merchant

Installation

composer require kameli/quickpay-v10

Examples

Process a payment

<?php

use Kameli\Quickpay\Quickpay;

$qp = new Quickpay('API_KEY', 'PRIVATE_KEY');
$payment = $qp->payments()->create([
    'currency' => 'DKK',
    'order_id' => 'SOME_UNIQUE_ORDER_ID',
]);

$link = $qp->payments()->link($payment->getId(), [
    'amount' => 10000, // amount in least valuable unit (øre)
]);

// Make the user follow the payment link which will take them to a form where they put in their card details
$url = $link->getUrl();

// When the form has been completed, a POST request will be sent to a specified url where you can validate it
if ($qp->validateCallback()) {
    $payment = $qp->receivePaymentCallback();

    // Capture the amount to charge the card
    $qp->payments()->captureAmount($payment->getId(), $payment->amount());

    // Handle order
}

Create a subscription and make recurring payments

Remember to enable subscriptions for the acquirer you are using.

<?php

use Kameli\Quickpay\Quickpay;

$qp = new Quickpay('API_KEY', 'PRIVATE_KEY');
$subscription = $qp->subscriptions()->create([
    'currency' => 'DKK',
    'order_id' => 'SOME_UNIQUE_ORDER_ID',
    'description' => 'Abonnement',
]);

$link = $qp->subscriptions()->link($subscription->getId(), [
    'amount' => 100, // the amount does not matter here, but is still required for some reason
]);

// Make the user follow the payment link which will take them to a form where they put in their card details
$url = $link->getUrl();

// When the form has been completed, a POST request will be sent to a specified url where you can validate it
if ($qp->validateCallback()) {
    $subscription = $qp->receiveSubscriptionCallback();
}

// Use the recurring method to make new payments
$payment = $qp->subscriptions()->recurring($subscription->getId(), [
    'amount' => 10000,
    'order_id' => 'SOME_UNIQUE_ORDER_ID',
]);

// Capture the amount to charge the card
$qp->payments()->captureAmount($payment->getId(), $payment->amount());

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.