Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@phylaxis
Created October 12, 2012 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phylaxis/3881830 to your computer and use it in GitHub Desktop.
Save phylaxis/3881830 to your computer and use it in GitHub Desktop.
Get Payment Details
SELECT subscriptions.subscription_id,
client_gateways.alias,
(CASE client_gateways.alias WHEN 'Authorize.net' THEN 'Credit Card'
WHEN 'PayPal Express Checkout' THEN 'Pay Pal'
ELSE '' END) as 'payment_type',
subscriptions.card_last_four,
subscriptions.amount,
IF (client_gateways.alias = 'Authorize.net' AND subscriptions.card_last_four != '',true,false) AS 'card_on_file'
FROM subscriptions
INNER JOIN customers ON subscriptions.customer_id = customers.customer_id
INNER JOIN client_gateways ON subscriptions.gateway_id = client_gateways.client_gateway_id
WHERE subscriptions.subscription_id = 2266
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment