buxdotph

Creator: coderz1093

Last updated:

0 purchases

buxdotph Image
buxdotph Images

Languages

Categories

Add to Cart

Description:

buxdotph

Bux.ph Dark SDK #
Secure Bux Credentials Implementation (Optional) #

Add [envify] to pubspec.yaml

dependencies:
envify: any

dev_dependencies:
envify_generator: any
build_runner: any
copied to clipboard

Set up .env

// .env
BUX_API_KEY=api_key
BUX_SANDBOX=true
BUX_CLIENT_ID=0000000001
BUX_API_SECRET=secret
copied to clipboard

create lib/env/env.dart on your project

//env.dart
import 'package:envify/envify.dart';

part 'env.g.dart';

@Envify()
abstract class Env {
static const bool buxSandbox = _Env.buxSandbox;
static const String buxApiKey = _Env.buxApiKey;
static const String buxClientId = _Env.buxClientId;
static const String buxApiSecret = _Env.buxApiSecret;
}
copied to clipboard

Run Build Runner

# dart
pub run build_runner build
# flutter
flutter pub run build_runner build
copied to clipboard
Note: Make sure to re-run this if you change any in your .env file

add to .gitigniore this entry env.g.dart and .env

Usage #

Add to Your pubspec.yaml

dependencies:
buxdotph: any
copied to clipboard

Initialize Bux

// generated env.dart
import 'env/env.dart';
import 'package:buxdotph/buxdotph.dart';

final Bux bux = const Bux(
apiKey: Env.buxApiKey,
apiSecret: Env.buxApiSecret,
clientId: Env.buxClientId,
sandbox: Env.buxSandbox,
);
copied to clipboard

Create CheckoutPayload

// with all paramaters filled up
import 'package:buxdotph/buxdotph';
import 'package:example/env/env.dart';
...


final CheckoutPayload payload = CheckoutPayload(
amount: 1000,
req_id: 'uuid_from_backend',
client_id: ${Env.buxClientId},
description: 'subscription',
notification_url: 'https://google.com',
expiry: 2,
email: '[email protected]',
contact: '09155555555',
name: 'John Dela Cruz',
redirect_url: 'https://goldcoders.dev',
param1: 'username',
param2: 'address',
);
copied to clipboard
// with minimum required parameters filled up
CheckoutPayload payload = CheckoutPayload(
amount: 1000,
req_id: 'bux001',
client_id: clientId,
description: 'test',
notification_url: 'https://goldcoders.dev/notify',
);
copied to clipboard

Pass the Payload to bux checkout

import 'package:buxdotph/buxdotph.dart';

...
await bux.checkout(payload);
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.