Skip to content

Commit 6f78dfe

Browse files
committed
Add paymentMethod method
1 parent e8fd6b3 commit 6f78dfe

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Subscription.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,16 @@ public function paddleEmail()
665665
return (string) $this->paddleInfo()['user_email'];
666666
}
667667

668+
/**
669+
* Get the payment method type from the subscription.
670+
*
671+
* @return string
672+
*/
673+
public function paymentMethod()
674+
{
675+
return (string) $this->paddleInfo()['payment_information']['payment_method'];
676+
}
677+
668678
/**
669679
* Get the card brand from the subscription.
670680
*

tests/Feature/SubscriptionsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ public function test_subscriptions_can_retrieve_their_payment_info()
199199
]);
200200

201201
$this->assertSame('john@example.com', $subscription->paddleEmail());
202+
$this->assertSame('card', $subscription->paymentMethod());
202203
$this->assertSame('master', $subscription->cardBrand());
203204
$this->assertSame('4050', $subscription->cardLastFour());
204205
}

0 commit comments

Comments
 (0)