@solidgate/vue-sdk
v1.29.0
Published
This repository is a Vue 3 wrapper for the Solidgate Client Software Development Kit (SDK).
Readme
Solidgate Vue3 SDK
This repository is a Vue 3 wrapper for the Solidgate Client Software Development Kit (SDK).
It supports rendering payment forms and resign forms, including custom container elements for Google Pay, Apple Pay, or alternative payment method (APM) buttons.
Check our
- Payment guide to understand business value better
- API Reference to find more examples of usage
Structure
Installation
Run the following command inside your Vue 3 project:
npm i @solidgate/vue-sdkUsage
Payment form
Render a payment form component in your Vue3 project.
<template>
<Payment :merchant-data="merchantData" />
</template>
<script lang="ts" setup>
import Payment, { InitConfig } from '@solidgate/vue-sdk'
const merchantData: InitConfig['merchantData'] = {
merchant: '<<--YOUR MERCHANT ID-->>',
signature: '<<--YOUR SIGNATURE OF THE REQUEST-->>',
paymentIntent: '<<--YOUR PAYMENT INTENT-->>'
}
</script>Custom containers
To render Google Pay, Apple Pay, PayPal, MB Way, or Pix QR buttons in separate containers, define payment as an asynchronous component and pass references to the container elements.
<template>
<Payment
:merchant-data="merchantData"
:google-pay-container-ref="googleButton"
:apple-pay-container-ref="appleButton"
:paypal-container-ref="paypalButton"
:mbway-container-ref="mbwayButton"
:pix-qr-container-ref="pixQrButton"
/>
<div ref="googleButton" />
<div ref="appleButton" />
<div ref="paypalButton" />
<div ref="mbwayButton" />
<div ref="pixQrButton" />
</template>
<script lang="ts" setup>
import { ref, defineAsyncComponent } from 'vue'
import { InitConfig } from '@solidgate/vue-sdk'
const Payment = defineAsyncComponent(() => import('@solidgate/vue-sdk'))
const googleButton = ref<HTMLDivElement>()
const appleButton = ref<HTMLDivElement>()
const paypalButton = ref<HTMLDivElement>()
const mbwayButton = ref<HTMLDivElement>()
const pixQrButton = ref<HTMLDivElement>()
const merchantData: InitConfig['merchantData'] = {
merchant: '<<--YOUR MERCHANT ID-->>',
signature: '<<--YOUR SIGNATURE OF THE REQUEST-->>',
paymentIntent: '<<--YOUR PAYMENT INTENT-->>'
}
</script>Resign form
Render a resign payment form component in your Vue3 project.
<template>
<Resign :resign-request="resignRequest" />
</template>
<script lang="ts" setup>
import { Resign, ResignRequest } from '@solidgate/vue-sdk'
const resignRequest: ResignRequest = {
merchant: '<<--YOUR MERCHANT ID-->>',
signature: '<<--YOUR SIGNATURE OF THE REQUEST-->>',
resignIntent: '<<--YOUR RESIGN INTENT-->>'
}
</script>Development server
Vue3 + Typescript + Vite
cd vue-sdknpm inpm run start- Navigate to http://localhost:3000/
Build
cd vue-sdknpm run buildcd dist- solid-payment.es.js is a js bundle
Looking for help? Contact us Want to contribute? Submit a pull request
