billing_client = AbacatePay::Clients::BillingClient.new
# Criando uma Cobrança Única
billing = billing_client.create(
AbacatePay::Resources::Billing.new(
frequency: AbacatePay::Enums::Billing::Frequencies::ONE_TIME,
methods: [AbacatePay::Enums::Billing::Methods::PIX],
products: [
AbacatePay::Resources::Billing::Product.new(
external_id: 'PRO-PLAN',
name: 'Pro plan',
description: 'Pro plan subscription',
quantity: 1,
price: 1000 # Preço em centavos
)
],
metadata: AbacatePay::Resources::Billing::Metadata.new(
return_url: 'https://yoursite.com/app',
completion_url: 'https://yoursite.com/payment/success'
),
customer: AbacatePay::Resources::Customer.new(
metadata: AbacatePay::Resources::Customer::Metadata.new(
name: 'Customer Name',
cellphone: '11999999999',
email: 'customer@example.com',
tax_id: '09240529020'
)
)
)
)
puts billing.url # URL de pagamento para seu cliente